Merge branch 'themes-updates' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2024-12-30 21:03:55 +02:00
commit 9c952173f4
4 changed files with 18 additions and 12 deletions

View file

@ -6,10 +6,6 @@
color: var(--inputTopbarText, var(--inputText));
}
a {
color: var(--link);
}
.inner-nav {
display: grid;
grid-template-rows: var(--navbar-height);
@ -91,10 +87,6 @@
width: 2em;
height: 100%;
text-align: center;
.svg-inline--fa {
color: var(--link);
}
}
.sitename {

View file

@ -32,6 +32,18 @@ export default {
directives: {
textColor: '--text'
}
},
{
component: 'Icon',
parent: {
component: 'ButtonUnstyled',
parent: {
component: 'TopBar'
}
},
directives: {
textColor: '--parent--text'
}
}
]
}

View file

@ -225,7 +225,7 @@ export const getTextColor = function (bg, text, preserve) {
const originalColor = convert(text).hex
const invertedColor = invertLightness(originalColor).hex
const invertedContrast = getContrastRatio(bg, invertedColor)
const invertedContrast = getContrastRatio(bg, convert(invertedColor).rgb)
let workColor
if (invertedContrast > originalContrast) {
@ -238,13 +238,14 @@ export const getTextColor = function (bg, text, preserve) {
const result = convert(rgb2hex(workColor)).hsl
const delta = result.l > 50 ? 1 : -1
const multiplier = 10
while (contrast < 4.5) {
while (contrast < 4.5 && result.l > 0 && result.l < 100) {
result.l += delta * multiplier
contrast = getContrastRatio(bg, result)
contrast = getContrastRatio(bg, convert(result).rgb)
console.log(convert(result).hex, result.l, contrast)
}
const base = typeof text.a !== 'undefined' ? { a: text.a } : {}
return Object.assign(base, result)
return Object.assign(convert(result).rgb, base)
}
/**

View file

@ -56,6 +56,7 @@
"bg": "#323337",
"fg": "#1D1E21",
"link": "#18A0E3",
"accent": "#6671E2",
"text": "#DBDDE0",
"cRed": "#E05053",
"cBlue": "#6671E2",