From 43c34d02db2477c6e847a5d7581b51be1f86e665 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 23 Mar 2025 18:22:06 +1100 Subject: misc code refactoring --- app.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app.tsx b/app.tsx index 820d322..ff7601a 100644 --- a/app.tsx +++ b/app.tsx @@ -15,22 +15,16 @@ import { App } from "astal/gtk3"; import { style } from "config"; import { initConfig, updateConfig } from "config/funcs"; -const shouldBeTransparent = (name: string) => - name === "base" || - name === "mantle" || - name === "crust" || - name.startsWith("surface") || - name.startsWith("overlay"); +const isLayer = (name: string) => + ["base", "mantle", "crust"].includes(name) || name.startsWith("surface") || name.startsWith("overlay"); const applyTransparency = (name: string, hex: string) => { - if (style.transparency.get() === "off" || !shouldBeTransparent(name)) return hex; + if (style.transparency.get() === "off" || !isLayer(name)) return hex; const amount = style.transparency.get() === "high" ? 0.58 : 0.78; return `color.change(${hex}, $alpha: ${amount})`; }; -const applyVibrancy = (hex: string) => { - return style.vibrant.get() ? `color.scale(${hex}, $saturation: 40%)` : hex; -}; +const applyVibrancy = (hex: string) => (style.vibrant.get() ? `color.scale(${hex}, $saturation: 40%)` : hex); export const loadStyleAsync = async () => { const schemeColours = Object.entries(Palette.get_default().colours) -- cgit v1.2.3-freya