Skip to content

Commit f86a6ea

Browse files
committed
fix: vibrancy with theme
1 parent a482911 commit f86a6ea

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/main/lib/theme.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { effect } from '@vue/reactivity'
22
import type { BrowserWindow, BrowserWindowConstructorOptions } from 'electron'
33
import { nativeTheme, systemPreferences } from 'electron'
44
import type { Theme, ThemeDefinition } from '@commas/types/theme'
5-
import { isDarkColor, mix, toCSSColor, toCSSHEX, toElectronHEX, toHSLA, toRGBA, toRGBAFromHSLA } from '../../shared/color'
5+
import { isDarkColor, mix, toCSSColor, toCSSHEX, toElectronHEX, toHSLA, toRGBA } from '../../shared/color'
66
import { provideIPC } from '../utils/compositions'
77
import { resourceFile, userFile } from '../utils/directory'
88
import { useDefaultSettings, useSettings } from './settings'
@@ -176,10 +176,9 @@ const theme = $computed(() => {
176176
definition.systemMagenta = systemPreferences.getSystemColor('pink')
177177
}
178178
definition.systemAccent = accentColor ? `#${accentColor.slice(0, 6)}` : ''
179-
const accentHSLA = accentColor ? toHSLA(toRGBA(`#${accentColor.slice(0, 6)}`)) : undefined
180-
definition.acrylicBackground = accentHSLA ? toCSSHEX(
181-
toRGBAFromHSLA({ ...accentHSLA, l: (0.5 + accentHSLA.l / 2) }),
182-
) : ''
179+
const backgroundHSLA = toHSLA(backgroundRGBA)
180+
const accentRGBA = accentColor ? toRGBA(`#${accentColor.slice(0, 6)}`) : undefined
181+
definition.acrylicBackground = accentRGBA ? toCSSHEX(mix(backgroundRGBA, accentRGBA, backgroundHSLA.s)) : ''
183182
definition.vibrancy = opacity < 1 ? undefined : vibrancy
184183
definition.variables = Object.fromEntries([
185184
...Object.entries({ ...THEME_CSS_COLORS, ...EXTRA_CSS_COLORS }).map(([key, attr]) => {

src/renderer/components/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ onMounted(() => {
155155
/* Default line height of xterm.js */
156156
line-height: 1.2;
157157
overflow: hidden;
158-
background-image: linear-gradient(to right bottom, color-mix(in sRGB, rgb(var(--acrylic-background) / var(--theme-opacity)) 10%, rgb(var(--theme-background) / var(--theme-opacity))), color-mix(in sRGB, rgb(var(--acrylic-background) / var(--theme-opacity)) 25%, rgb(var(--theme-background) / var(--theme-opacity))));
158+
background-image: linear-gradient(to right bottom, color-mix(in sRGB, rgb(var(--acrylic-background) / var(--theme-opacity)) 6%, rgb(var(--theme-background) / var(--theme-opacity))), color-mix(in sRGB, rgb(var(--acrylic-background) / var(--theme-opacity)) 12%, rgb(var(--theme-background) / var(--theme-opacity))));
159159
transition: color 0.2s;
160160
&.is-vibrant {
161-
background-image: linear-gradient(to right bottom, rgb(var(--acrylic-background) / 10%), rgb(var(--acrylic-background) / 25%));
161+
background-image: linear-gradient(to right bottom, rgb(var(--acrylic-background) / 6%), rgb(var(--acrylic-background) / 12%));
162162
}
163163
}
164164
.content {

0 commit comments

Comments
 (0)