Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-1015 Implementer should be able to configure primary color #272

Merged
merged 5 commits into from
Jan 19, 2022

Conversation

brandones
Copy link
Collaborator

@brandones brandones commented Jan 19, 2022

@brandones brandones marked this pull request as draft January 19, 2022 04:06
@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2022

File size impact

Merging config-brand into master impact files as follow:

@openmrs/esm-devtools-app (+5.16%)
Files new size
packages/apps/esm-devtools-app/dist/217.js 315 kB (+16.7 kB / +5.58%) ↗️
Unmodified (4) 24.8 kB (0 B / +0%) 👻
Total (5) 340 kB (+16.7 kB / +5.16%) ↗️
@openmrs/esm-implementer-tools-app (+1.05%)
Files new size
packages/apps/esm-implementer-tools-app/dist/217.js 315 kB (+16.7 kB / +5.58%) ↗️
Unmodified (16) 1.29 MB (0 B / +0%) 👻
Total (17) 1.6 MB (+16.7 kB / +1.05%) ↗️
@openmrs/esm-login-app (+1.15%)
Files new size
packages/apps/esm-login-app/dist/217.js 315 kB (+16.7 kB / +5.58%) ↗️
packages/apps/esm-login-app/dist/130.js 83.1 kB (+1.5 kB / +1.84%) ↗️
packages/apps/esm-login-app/dist/309.js 95.3 kB (+1.5 kB / +1.6%) ↗️
packages/apps/esm-login-app/dist/592.js 81.3 kB (+1.5 kB / +1.88%) ↗️
packages/apps/esm-login-app/dist/747.js 86.4 kB (+568 B / +0.66%) ↗️
Unmodified (23) 1.25 MB (0 B / +0%) 👻
Total (28) 1.92 MB (+21.7 kB / +1.15%) ↗️
@openmrs/esm-offline-tools-app (+1.54%)
Files new size
packages/apps/esm-offline-tools-app/dist/217.js 315 kB (+16.7 kB / +5.58%) ↗️
packages/apps/esm-offline-tools-app/dist/780.js 258 kB (+6 kB / +2.38%) ↗️
packages/apps/esm-offline-tools-app/dist/294.js 238 kB (+4.5 kB / +1.92%) ↗️
packages/apps/esm-offline-tools-app/dist/469.js 102 kB (+3 kB / +3.03%) ↗️
packages/apps/esm-offline-tools-app/dist/471.js 111 kB (+3 kB / +2.77%) ↗️
packages/apps/esm-offline-tools-app/dist/113.js 25.8 kB (+1.5 kB / +6.18%) ↗️
packages/apps/esm-offline-tools-app/dist/730.js 86.3 kB (+1.5 kB / +1.77%) ↗️
Unmodified (16) 1.26 MB (0 B / +0%) 👻
Total (23) 2.39 MB (+36.2 kB / +1.54%) ↗️
@openmrs/esm-primary-navigation-app (+1.33%)
Files new size
packages/apps/esm-primary-navigation-app/dist/217.js 315 kB (+16.7 kB / +5.58%) ↗️
packages/apps/esm-primary-navigation-app/dist/160.js 317 kB (+8.17 kB / +2.65%) ↗️
packages/apps/esm-primary-navigation-app/dist/686.js 78.4 kB (+1.5 kB / +1.95%) ↗️
packages/apps/esm-primary-navigation-app/dist/878.js 82 kB (+567 B / +0.7%) ↗️
Unmodified (14) 1.25 MB (0 B / +0%) 👻
Total (18) 2.05 MB (+26.9 kB / +1.33%) ↗️
@openmrs/esm-app-shell (+0.05%)
Files new size
packages/shell/esm-app-shell/dist/openmrs.js 1.03 MB (+499 B / +0.05%) ↗️
packages/shell/esm-app-shell/dist/openmrs.css 543 kB (+427 B / +0.08%) ↗️
packages/shell/esm-app-shell/dist/service-worker.js 160 kB (0 B / +0%) 👻
Unmodified (1) 9.55 kB (0 B / +0%) 👻
Total (4) 1.74 MB (+926 B / +0.05%) ↗️
Generated by @jsenv/file-size-impact during Report bundle size#1720415514 on 3b4d34e

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is basically the right approach. The main downside is that we're requiring this slightly verbose pattern wherever this colour is used.

This might be more invasive, but maybe we could leverage a Sass mixin, e.g.,

@mixin brand-background-color {
  background-color: $brand-01;
  background-color: var(--brand-01);
}

Then again, maybe that's just making more trouble?

Comment on lines 74 to 77
// background-color: $brand-01;
background-color: var(--brand-01);
// border-bottom: $brand-02;
border-bottom: var(--brand-02);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean-up: we should probably keep the commented-out lines.

Comment on lines 30 to 34
:root {
--brand-01: #005d5d;
--brand-02: #004144;
--brand-teal-01: #007d79;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in an scss file, wouldn't it make sense to do:

Suggested change
:root {
--brand-01: #005d5d;
--brand-02: #004144;
--brand-teal-01: #007d79;
}
:root {
--brand-01: $brand-01;
--brand-02: $brand-02;
--brand-teal-01: $brand-teal-01;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secondary point to all of this, but brand-teal-01 could use a rename...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strangely, that doesn't work—if you do this then the variable --brand-01 gets set to the string literal "$brand-01".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secondary point to all of this, but brand-teal-01 could use a rename...

Agreed. brand-01 is lighter than brand-02, and brand-teal-01 is lighter than brand-01. We can either call it brand-03 and not worry about the lightness, or we can call it brand-light-01 (and thereby defer the problem until there are two new brand colors to add). Other suggestions welcome.

Screenshot from 2022-01-19 08-52-08

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I think brand-light-01 at least gets the goal across better? I'm thinking that we'll definitely need some sort of documentation with annotated screenshots so people can see where the branding takes place.

@brandones
Copy link
Collaborator Author

If we're going to use a mixin I'd say go all the way and use this one:

@mixin var($property, $varName) {
  #{$property}: map-get($vars, $varName);
  #{$property}: var(--#{$varName});
}

which is used like

@include var(background-color, brand-01);

However, I'm inclined to think that people outside the squad would rarely use this strange syntax.

Unless—and this is something I think we should do—we get rid of the $brand-01 (et al.) SASS variables. That would force people to use either that or the CSS variable, either of which would be preferable.

@brandones brandones changed the title Make brand color configurable O3-1015 Implementer should be able to configure primary color Jan 19, 2022
@ibacher
Copy link
Member

ibacher commented Jan 19, 2022

However, I'm inclined to think that people outside the squad would rarely use this strange syntax.

Yeah... Sass mixins don't make for easy-reading syntax. I was just trying to come up with a way to avoid copy-and-paste where we end up with just the background-color: $brand-01 everywhere.

we get rid of the $brand-01 (et al.) SASS variables

I don't necessarily disagree with this, but it needs some careful working through since at least some of the variables we define seem to be intended as overrides of Carbon-defined variables (though at a quick pass, it doesn't look like we're actually using different values).

That would force people to use either that or the CSS variable, either of which would be preferable.

Or the worst-case scenario background-color: #005d5d 😬

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like this!

@brandones brandones marked this pull request as ready for review January 19, 2022 22:15
@brandones brandones merged commit ab0ebd4 into master Jan 19, 2022
@brandones brandones deleted the config-brand branch January 19, 2022 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants