add directive to completely disable automatic text color creation

This commit is contained in:
Henry Jameson 2024-02-07 16:15:25 +02:00
parent a9efbd2553
commit 85d55c55e7
2 changed files with 11 additions and 7 deletions

View File

@ -8,7 +8,8 @@ export default {
directives: { directives: {
textColor: '--text', textColor: '--text',
textOpacity: 0.5, textOpacity: 0.5,
textOpacityMode: 'mixrgb' textOpacityMode: 'mixrgb',
textAuto: 'no-auto'
} }
} }
] ]

View File

@ -392,12 +392,15 @@ export const init = (extraRuleset, palette) => {
const lowerLevelSelector = selector.split(/ /g).slice(0, -1).join(' ') const lowerLevelSelector = selector.split(/ /g).slice(0, -1).join(' ')
const lowerLevelBackground = cache[lowerLevelSelector].background const lowerLevelBackground = cache[lowerLevelSelector].background
const textColor = getTextColor( // TODO properly provide "parent" text color?
convert(lowerLevelBackground).rgb, const intendedTextColor = convert(findColor(inheritedTextColor, null, lowerLevelBackground)).rgb
// TODO properly provide "parent" text color? const textColor = newTextRule.directives.textAuto === 'no-auto'
convert(findColor(inheritedTextColor, null, lowerLevelBackground)).rgb, ? intendedTextColor
newTextRule.directives.textAuto === 'preserve' : getTextColor(
) convert(lowerLevelBackground).rgb,
intendedTextColor,
newTextRule.directives.textAuto === 'preserve'
)
// Storing color data in lower layer to use as custom css properties // Storing color data in lower layer to use as custom css properties
cache[lowerLevelSelector].textDefined = cache[lowerLevelSelector].textDefined || {} cache[lowerLevelSelector].textDefined = cache[lowerLevelSelector].textDefined || {}