We are working on replacing our older custom theme implementation (applyTheme()) currently used to change component colors throughout the webapp to match the selected theme. We have decided to utilize CSS variables as a replacement and so we now need to replace all occurances of changeCSS() within the applyTheme() function with corresponding CSS variables directly in the CSS files. This ticket is part of a larger campaign.
Go to line number 566 in the file utils/utils.jsx. You should see the following:
changeCss('.team-sidebar .fa', 'color:' <ins> theme.sidebarHeaderTextColor);
For this ticket, we will be replacing the use of the Javascript variable theme.sidebarHeaderTextColor from this line of code with the CSS variable --sidebar-header-text-color. Please work off the branch campaign/applytheme_sidebar-header-text-color to avoid conflicts with other tickets for the same campaign.
Run through these steps to determine where to apply the new CSS variable followed by removing the call to changeCSS() from utils/utils.jsx:
changeCSS and specifically the final selector (eg. .app__body .sidebar--menu)changeCSS() above (eg. 'background:' </ins> theme.sidebarBg)sass/layout/_sidebar-menu.scss, ln.3)changeCSS() from utils/utils.jsx.campaign/applytheme_sidebar-header-text-color. We will be using this branch to review and QA changes in batches on a regular basis instead of on each individual ticket in the campaign given the number of overall tickets for this campaign.Notes:
changeCSS() affect the styles of sections of the UI that might not be visible by default. Remember to check modals, pop-ups, menus and different interaction states (hover, active, etc.) as necessary based on the particular ticket you are working onchangeCSS() include the use of a custom changeOpacity() function when applying colours that need to be partially transparent. These instances will need to be replaced with the rgba CSS function. For example, changeOpacity(theme.sidebarBg, 0.3)) in utils/utils.jsx would become rgba(var(--sidebar-bg-rgb), 0.3) in CSS. Appending -rgb to the CSS variable name is necessary when using one of the theme variables to work with the rgba CSS function.changeCSS() line is no longer valid, in which case, just removing the line as part of your PR is a perfectly valid solution.Feel free to ask for help by messaging either @deanwhillier or @hmhealey or by posting in the ~webapp channel on the Mattermost Community server.
If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
JIRA ticket: https://mattermost.atlassian.net/browse/MM-29465
Hello @deanwhillier , I'd be happy to take this one on!
It鈥檚 all yours @prazolpp, thanks!
It looks like the utils/utils.jsx file is in the mattermost/mattermost-webapp repo though
Yeah, that's correct. We currently put web app Help Wanted tickets here since the server and web app are pretty tightly coupled and because many of them require changes to both repositories. This one just requires web app changes though