better v1 detection, better menu-item consistency
This commit is contained in:
parent
d3b5f76486
commit
c83ddb0b2b
6 changed files with 57 additions and 12 deletions
|
|
@ -8,11 +8,11 @@ import { chunk } from 'lodash'
|
|||
|
||||
export const applyTheme = async (input) => {
|
||||
let extraRules
|
||||
if (input.themeType !== 1) {
|
||||
if (input.themeFileVersion === 1) {
|
||||
extraRules = convertTheme2To3(input)
|
||||
} else {
|
||||
const { theme } = generatePreset(input)
|
||||
extraRules = convertTheme2To3(theme)
|
||||
} else {
|
||||
extraRules = convertTheme2To3(input)
|
||||
}
|
||||
|
||||
const themes3 = init(extraRules, '#FFFFFF')
|
||||
|
|
@ -125,7 +125,7 @@ export const getPreset = (val) => {
|
|||
.then((themes) => themes[val] ? themes[val] : themes['pleroma-dark'])
|
||||
.then((theme) => {
|
||||
const isV1 = Array.isArray(theme)
|
||||
const data = isV1 ? { themeType: 1 } : theme.theme
|
||||
const data = isV1 ? {} : theme.theme
|
||||
|
||||
if (isV1) {
|
||||
const bg = hex2rgb(theme[1])
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export const getCssRules = (rules) => rules.map(rule => {
|
|||
return [
|
||||
header,
|
||||
directives + ';',
|
||||
(!rule.virtual && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
|
||||
(rule.component === 'Text' && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
|
||||
'',
|
||||
virtualDirectives,
|
||||
footer
|
||||
|
|
|
|||
|
|
@ -275,8 +275,12 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
|
|||
selector: cssSelector.split(/ /g).slice(0, -1).join(' '),
|
||||
...combination,
|
||||
directives: {},
|
||||
virtualDirectives,
|
||||
virtualDirectivesRaw
|
||||
virtualDirectives: {
|
||||
[virtualName]: getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
|
||||
},
|
||||
virtualDirectivesRaw: {
|
||||
[virtualName]: textColor
|
||||
}
|
||||
}
|
||||
} else {
|
||||
computed[selector] = computed[selector] || {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue