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.
In the Mattermost Webapp repo, go to line number 701 in the file utils/utils.jsx (link). You should see the following (might not be the exact line number):
changeCss('.app__body .channel-header .pinned-posts-button svg', 'fill:' <ins> changeOpacity(theme.centerChannelColor, 0.6));
campaign/applytheme_center-channel-colortheme.centerChannelColor with the CSS variable --center-channel-color from the line abovecampaign/applytheme_center-channel-color when ready (not 'Master')For this ticket, we will be replacing the use of the Javascript variable theme.centerChannelColor from the above line of code with the CSS variable --center-channel-color. Please work off the branch campaign/applytheme_center-channel-color to avoid conflicts with other tickets for the same campaign. The line number may not be the same as when this ticket was created, but should be close.
You can use these steps to help 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)utils/utils.jsx.campaign/applytheme_center-channel-color. We will be using this branch to review and QA changes in batches 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 line 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-29843
The link for the repo is broken...can you update it to this one
https://github.com/mattermost/mattermost-webapp/tree/campaign/applytheme_center-channel-color
@deanwhillier
Hello, can I contribute on this issue?