diff --git a/ghost/admin/app/helpers/hex-contrast.js b/ghost/admin/app/helpers/hex-contrast.js new file mode 100644 index 0000000000..6cbb96255d --- /dev/null +++ b/ghost/admin/app/helpers/hex-contrast.js @@ -0,0 +1,6 @@ +import {Color, textColorForBackgroundColor} from '@tryghost/color-utils'; +import {helper} from '@ember/component/helper'; + +export default helper(function hexContrast([hex]) { + return textColorForBackgroundColor(Color(hex)).hex(); +}); diff --git a/ghost/admin/app/templates/application.hbs b/ghost/admin/app/templates/application.hbs index 3bb98c132c..e312bfb39d 100644 --- a/ghost/admin/app/templates/application.hbs +++ b/ghost/admin/app/templates/application.hbs @@ -55,8 +55,8 @@ } .email-cta-button-text-input:hover, .gh-btn-accent:hover { - color: {{hex-adjust this.ui.textColorForAdjustedAccentBackground l=-15}}; - background-color: {{hex-adjust this.settings.accentColor l=-15}} + color: {{hex-contrast this.ui.adjustedAccentColor}}; + background-color: {{hex-adjust this.ui.adjustedAccentColor l=-15}} } .email-cta-button-text-input::placeholder { {{!-- TODO: saturation adjustment for white/black doesn't work --}}