2 Commits

Author SHA1 Message Date
Sodbileg Gansukh
9a2f77a5b9 v1.2.3 2024-06-03 17:19:32 +08:00
Sodbileg Gansukh
b9ae39eab9 Made the background color calculation compatible with shortened hex value 2024-06-03 17:19:03 +08:00
2 changed files with 6 additions and 1 deletions

View File

@@ -26,6 +26,11 @@
https://gomakethings.com/dynamically-changing-the-text-color-based-on-background-color-contrast-with-vanilla-js/ */
var accentColor = getComputedStyle(document.documentElement).getPropertyValue('--background-color');
accentColor = accentColor.trim().slice(1);
if (accentColor.length === 3) {
accentColor = accentColor[0] + accentColor[0] + accentColor[1] + accentColor[1] + accentColor[2] + accentColor[2];
}
var r = parseInt(accentColor.substr(0, 2), 16);
var g = parseInt(accentColor.substr(2, 2), 16);
var b = parseInt(accentColor.substr(4, 2), 16);

View File

@@ -2,7 +2,7 @@
"name": "source",
"description": "A default theme for the Ghost publishing platform",
"demo": "https://source.ghost.io",
"version": "1.2.2",
"version": "1.2.3",
"engines": {
"ghost": ">=5.0.0"
},