Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom theme properties #404

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/util/ColorTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ const ColorThemeUtil = {
merged.light.warning = light.warning ? light.warning : LIGHT_WARNING;
merged.light.error = light.error ? light.error : LIGHT_ERROR;

// apply unknown / custom theme properties to light theme
for (const themeProp in light) {
const hasProp = themeProp in merged.light;
if (!hasProp) {
merged.light[themeProp] = light[themeProp];
}
}

// If light theme is configured with at least the secondary color
if (!dark || !dark.secondary) {
// fallback to default dark theme
Expand Down Expand Up @@ -144,6 +152,14 @@ const ColorThemeUtil = {
merged.dark.warning = dark.warning ? dark.warning : DARK_WARNING;
merged.dark.error = dark.error ? dark.error : DARK_ERROR;

// apply unknown / custom theme properties to dark theme
for (const themeProp in dark) {
const hasProp = themeProp in merged.dark;
if (!hasProp) {
merged.dark[themeProp] = dark[themeProp];
}
}

return merged;
},

Expand Down
Loading