Initial build of primary color contrast

This commit is contained in:
Michael Shamoon committed 2022-04-13 08:18:09 -07:00
1 parent d5d7e2edbc
commit d98a016087
5 files changed
+237 -179

No files matched your search

@@ -132,8 +132,22 @@ export class SettingsService {
: this.renderer.removeClass(this.document.body, 'color-scheme-dark')
}
// remove these in case they were there
this.renderer.removeClass(this.document.body, 'text-bg-dark')
this.renderer.removeClass(this.document.body, 'text-bg-light')
if (themeColor) {
const hsl = hexToHsl(themeColor)
const useDarkTextColor =
parseInt(themeColor.replace('#', ''), 16) > 0xffffff / 1.5
if (useDarkTextColor) {
this.renderer.addClass(this.document.body, 'text-bg-dark')
this.renderer.removeClass(this.document.body, 'text-bg-light')
} else {
this.renderer.addClass(this.document.body, 'text-bg-light')
this.renderer.removeClass(this.document.body, 'text-bg-dark')
}
this.renderer.setStyle(
document.documentElement,
'--pngx-primary',