From bd4a804a969b4217120bd39cdeb85ceeeea7adb0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 22 Aug 2024 12:07:12 +0100 Subject: [PATCH] Add accent colors to all buttons --- .../bbui/src/ActionButton/ActionButton.svelte | 22 +++++++++++++++++++ packages/bbui/src/helpers.js | 10 +++++++++ .../buttons/TableFilterButton.svelte | 9 +++++++- .../buttons/grid/GridAutomationsButton.svelte | 9 ++++++-- .../grid/GridColumnsSettingButton.svelte | 1 + .../buttons/grid/GridRowActionsButton.svelte | 13 +++++++---- .../buttons/grid/GridScreensButton.svelte | 9 +++++++- 7 files changed, 65 insertions(+), 8 deletions(-) diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index 7019ad7d2c..8b2d11232c 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -3,6 +3,7 @@ import { createEventDispatcher } from "svelte" import Tooltip from "../Tooltip/Tooltip.svelte" import { fade } from "svelte/transition" + import { hexToRGBA } from "../helpers" const dispatch = createEventDispatcher() @@ -17,9 +18,22 @@ export let fullWidth = false export let noPadding = false export let tooltip = "" + export let accentColor = null let showTooltip = false + $: accentStyle = getAccentStyle(accentColor) + + const getAccentStyle = color => { + if (!color) { + return "" + } + let style = "" + style += `--accent-bg-color:${hexToRGBA(color, 0.15)};` + style += `--accent-border-color:${hexToRGBA(color, 0.35)};` + return style + } + function longPress(element) { if (!longPressable) return let timer @@ -47,6 +61,7 @@ on:mouseover={() => (showTooltip = true)} on:mouseleave={() => (showTooltip = false)} on:focus={() => (showTooltip = true)} + style={accentStyle} >