From a42ea0961aeef51e8427abb19f6b2dec8f27fcef Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 22 Mar 2022 12:37:57 -0500 Subject: [PATCH] Generate Tailwind colors from brandColor/accentColor --- app/soapbox/containers/soapbox.js | 4 +- app/soapbox/features/ui/components/navbar.tsx | 12 +- app/soapbox/types/colors.ts | 10 ++ app/soapbox/utils/__tests__/colors-test.js | 22 ++++ app/soapbox/utils/colors.ts | 123 ++++++++++++++++++ app/soapbox/utils/theme.ts | 104 ++++++--------- 6 files changed, 203 insertions(+), 72 deletions(-) create mode 100644 app/soapbox/types/colors.ts create mode 100644 app/soapbox/utils/__tests__/colors-test.js create mode 100644 app/soapbox/utils/colors.ts diff --git a/app/soapbox/containers/soapbox.js b/app/soapbox/containers/soapbox.js index c702ea12c..aad96badb 100644 --- a/app/soapbox/containers/soapbox.js +++ b/app/soapbox/containers/soapbox.js @@ -25,7 +25,7 @@ import { createGlobals } from 'soapbox/globals'; import messages from 'soapbox/locales/messages'; import { makeGetAccount } from 'soapbox/selectors'; import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types'; -import { colorsToCss } from 'soapbox/utils/theme'; +import { themeColorsToCSS } from 'soapbox/utils/theme'; import { INTRODUCTION_VERSION } from '../actions/onboarding'; import { preload } from '../actions/preload'; @@ -84,7 +84,7 @@ const mapStateToProps = (state) => { dyslexicFont: settings.get('dyslexicFont'), demetricator: settings.get('demetricator'), locale: validLocale(locale) ? locale : 'en', - themeCss: colorsToCss(soapboxConfig.get('colors').toJS()), + themeCss: themeColorsToCSS(soapboxConfig.get('brandColor') || '#0482d8', soapboxConfig.get('accentColor', '')), brandColor: soapboxConfig.get('brandColor'), themeMode: settings.get('themeMode'), singleUserMode, diff --git a/app/soapbox/features/ui/components/navbar.tsx b/app/soapbox/features/ui/components/navbar.tsx index 2f6ffe8df..d9198ecc4 100644 --- a/app/soapbox/features/ui/components/navbar.tsx +++ b/app/soapbox/features/ui/components/navbar.tsx @@ -33,11 +33,13 @@ const Navbar = () => {