palettes/style meta inconsistency

This commit is contained in:
Henry Jameson 2024-11-19 01:16:51 +02:00
parent 973e8697bc
commit ca5c24452e
6 changed files with 153 additions and 17 deletions

View file

@ -172,8 +172,8 @@ const AppearanceTab = {
const result = this.mergedConfig.styleCustomData const result = this.mergedConfig.styleCustomData
.filter(x => x.component.startsWith('@palette')) .filter(x => x.component.startsWith('@palette'))
.map(x => { .map(x => {
const { variant, directives } = x
const { const {
variant,
bg, bg,
fg, fg,
text, text,
@ -184,10 +184,10 @@ const AppearanceTab = {
cGreen, cGreen,
cOrange, cOrange,
wallpaper wallpaper
} = x } = directives
const result = { const result = {
name: `${meta.name}: ${variant}`, name: `${meta.directives.name || this.$t('settings.style.themes3.palette.imported')}: ${variant}`,
bg, bg,
fg, fg,
text, text,
@ -240,12 +240,12 @@ const AppearanceTab = {
return themeVersion return themeVersion
}, },
isCustomThemeUsed () { isCustomThemeUsed () {
const { theme } = this.mergedConfig const { customTheme, customThemeSource } = this.mergedConfig
return theme === 'custom' return customTheme != null || customThemeSource != null
}, },
isCustomStyleUsed (name) { isCustomStyleUsed (name) {
const { style } = this.mergedConfig const { styleCustomData } = this.mergedConfig
return style === 'custom' return styleCustomData != null
}, },
...SharedComputedObject() ...SharedComputedObject()
}, },

View file

@ -102,7 +102,7 @@
@click="() => setPaletteCustom(p)" @click="() => setPaletteCustom(p)"
> >
<label> <label>
{{ p.name }} {{ p.name ?? $t('settings.style.themes3.palette.user') }}
</label> </label>
<span <span
v-for="c in palettesKeys" v-for="c in palettesKeys"

View file

@ -86,7 +86,6 @@ export default {
exports.isActive = computed(() => { exports.isActive = computed(() => {
const tabSwitcher = getCurrentInstance().parent.ctx const tabSwitcher = getCurrentInstance().parent.ctx
console.log('TABSW', tabSwitcher)
return tabSwitcher ? tabSwitcher.isActive('style') : false return tabSwitcher ? tabSwitcher.isActive('style') : false
}) })
@ -109,10 +108,12 @@ export default {
const metaRule = computed(() => ({ const metaRule = computed(() => ({
component: '@meta', component: '@meta',
name: exports.name.value, directives: {
author: exports.author.value, name: exports.name.value,
license: exports.license.value, author: exports.author.value,
website: exports.website.value license: exports.license.value,
website: exports.website.value
}
})) }))
// ## Palette stuff // ## Palette stuff
@ -190,9 +191,9 @@ export default {
return { return {
component: '@palette', component: '@palette',
variant: name, variant: name,
...Object directives: Object
.entries(rest) .entries(rest)
.filter(([k, v]) => v) .filter(([k, v]) => v && k)
.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {}) .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
} }
}) })
@ -203,6 +204,7 @@ export default {
return palettes.map(({ name, ...palette }) => { return palettes.map(({ name, ...palette }) => {
const entries = Object const entries = Object
.entries(palette) .entries(palette)
.filter(([k, v]) => v && k)
.map(([slot, data]) => ` ${slot}: ${data};`) .map(([slot, data]) => ` ${slot}: ${data};`)
.join('\n') .join('\n')
@ -561,7 +563,9 @@ export default {
const virtualDirectivesOut = computed(() => { const virtualDirectivesOut = computed(() => {
return [ return [
'Root {', 'Root {',
...virtualDirectives.value.map(vd => ` --${vd.name}: ${vd.valType} | ${vd.value};`), ...virtualDirectives.value
.filter(vd => vd.name && vd.valType && vd.value)
.map(vd => ` --${vd.name}: ${vd.valType} | ${vd.value};`),
'}' '}'
].join('\n') ].join('\n')
}) })

View file

@ -750,6 +750,7 @@
"more_settings": "More settings", "more_settings": "More settings",
"style": { "style": {
"custom_theme_used": "(Custom theme)", "custom_theme_used": "(Custom theme)",
"custom_style_used": "(Custom style)",
"stock_theme_used": "(Stock theme)", "stock_theme_used": "(Stock theme)",
"themes2_outdated": "Editor for Themes V2 is being phased out and will eventually be replaced with a new one that takes advantage of new Themes V3 engine. It should still work but experience might be degraded and inconsistent.", "themes2_outdated": "Editor for Themes V2 is being phased out and will eventually be replaced with a new one that takes advantage of new Themes V3 engine. It should still work but experience might be degraded and inconsistent.",
"appearance_tab_note": "Changes on this tab do not affect the theme used, so exported theme will be different from what seen in the UI", "appearance_tab_note": "Changes on this tab do not affect the theme used, so exported theme will be different from what seen in the UI",
@ -775,7 +776,8 @@
"v2_unsupported": "Older v2 themes don't support palettes. Switch to v3 theme to make use of palettes", "v2_unsupported": "Older v2 themes don't support palettes. Switch to v3 theme to make use of palettes",
"bundled": "Bundled palettes", "bundled": "Bundled palettes",
"style": "Palettes provided by selected style", "style": "Palettes provided by selected style",
"user": "Custom palette" "user": "Custom palette",
"imported": "Imported"
}, },
"editor": { "editor": {
"title": "Style", "title": "Style",

View file

@ -0,0 +1,127 @@
@meta {
name: Redmond DX;
author: HJ;
license: WTFPL;
website: ebin.club;
}
@palette.Modern {
bg: #D3CFC7;
fg: #092369;
text: #000000;
link: #0000FF;
accent: #A5C9F0;
cRed: #FF3000;
cBlue: #009EFF;
cGreen: #309E00;
cOrange: #FFCE00;
}
@palette.Classic {
bg: #BFBFBF;
fg: #000180;
text: #000000;
link: #0000FF;
accent: #A5C9F0;
cRed: #FF0000;
cBlue: #2E2ECE;
cGreen: #007E00;
cOrange: #CE8F5F;
}
@palette.Vapor {
bg: #F0ADCD;
fg: #a177ee;
text: #602040;
link: #086866;
accent: #9DF7C8;
cRed: #ff0088;
cBlue: #20c8e9;
cGreen: #0fd27d;
cOrange: #ECE646;
}
Root {
--gradientColor: color | $brightness(--fg, 20);
--inputColor: color | #FFFFFF;
--bevelLight: color | $brightness(--bg 50);
--bevelDark: color | $brightness(--bg -20);
--bevelExtraDark: color | #404040;
--buttonDefaultBevel: shadow | $borderSide(--bevelExtraDark bottom-right 1 1), $borderSide(--bevelLight top-left 1 1), $borderSide(--bevelDark bottom-right 1 2);
--buttonPressedBevel: shadow | inset 0 0 0 1 #000000 / 1 #Outer , inset 0 0 0 2 --bevelExtraDark / 1 #inner;
--defaultInputBevel: shadow | $borderSide(--bevelLight bottom-right 1), $borderSide(--bevelDark top-left 1 1), $borderSide(--bg bottom-right 1 2), $borderSide(--bevelExtraDark top-left 1 2);
}
Button:toggled {
background: --bg;
shadow: --buttonPressedBevel
}
Button:focused {
shadow: --buttonDefaultBevel, 0 0 0 1 #000000 / 1
}
Button:pressed {
shadow: --buttonPressedBevel
}
Button:hover {
shadow: --buttonDefaultBevel;
background: --bg
}
Button {
shadow: --buttonDefaultBevel;
background: --bg;
roundness: 0
}
Button:pressed:hover {
shadow: --buttonPressedBevel
}
Input {
background: $mod(--bg -80);
shadow: --defaultInputBevel;
roundness: 0
}
Panel {
shadow: --buttonDefaultBevel;
roundness: 0
}
PanelHeader {
shadow: inset -1100 0 1000 -1000 --gradientColor / 1 #Gradient ;
background: --fg
}
Tab:hover {
background: --bg;
shadow: --buttonDefaultBevel
}
Tab:active {
background: --bg
}
Tab:active:hover {
background: --bg
}
Tab:active:hover:disabled {
background: --bg
}
Tab:hover:disabled {
background: --bg
}
Tab:disabled {
background: --bg
}
Tab {
background: --bg;
shadow: --buttonDefaultBevel
}

3
static/styles/index.json Normal file
View file

@ -0,0 +1,3 @@
{
"Redmond DX": "/static/styles/Redmond DX.json"
}