Fix branding window defaulting everything to black

This commit is contained in:
2025-10-17 13:37:59 +02:00
parent b409ff009d
commit 4de6331551
3 changed files with 51 additions and 58 deletions

View File

@@ -5,36 +5,36 @@ import rgb2hex from "pure-color/convert/rgb2hex";
import type { FSNode, FSNodeProperties } from "lib/FilesystemAPI.svelte";
type Style = {
input_background: string,
input_hover_background: string,
input_text: string,
highlight_color: string,
highlight_background: string,
highlight_text_color: string,
link_color: string,
danger_color: string,
danger_text_color: string,
background_color: string,
background: string,
background_text_color: string,
background_pattern_color: string,
body_color: string,
body_background: string,
body_text_color: string,
shaded_background: string,
separator: string,
shadow_color: string,
card_color: string,
background_image: string,
background_image_size: string,
background_image_position: string,
background_image_repeat: string,
input_background?: string,
input_hover_background?: string,
input_text?: string,
highlight_color?: string,
highlight_background?: string,
highlight_text_color?: string,
link_color?: string,
danger_color?: string,
danger_text_color?: string,
background_color?: string,
background?: string,
background_text_color?: string,
background_pattern_color?: string,
body_color?: string,
body_background?: string,
body_text_color?: string,
shaded_background?: string,
separator?: string,
shadow_color?: string,
card_color?: string,
background_image?: string,
background_image_size?: string,
background_image_position?: string,
background_image_repeat?: string,
}
// Generate a branding style from a file's properties map
export const branding_from_path = (path: Array<FSNode>) => {
let style = <Style>{}
for (let node of path) {
const style = {}
for (const node of path) {
add_styles(style, node.properties)
}
last_generated_style = style
@@ -43,9 +43,9 @@ export const branding_from_path = (path: Array<FSNode>) => {
// The last style which was generated is cached, when we don't have a complete
// path to generate the style with we will use the cached style as a basis
let last_generated_style = <Style>{}
export const branding_from_node = (node: FSNode) => {
add_styles(last_generated_style, node.properties)
let last_generated_style: Style = {}
export const branding_from_props = (props: FSNodeProperties) => {
add_styles(last_generated_style, props)
return gen_css(last_generated_style)
}