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} >