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

Add --farmos-map-accent-color CSS property #186

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

paul121
Copy link
Member

@paul121 paul121 commented Oct 24, 2022

Fixes #181

The basic issue here is that we define the color: green style in two places. Platforms integrating farmOS-map need to override this CSS in two (in the future, maybe more) places in order to achieve consistent colors.

This introduces the concept of an "accent" color to farmOS-map as a custom CSS property --farmos-map-accent-color at the :root pseudo-class. I got this idea from Drupal Gin which uses these custom properties quite extensively. The custom CSS property is like a variable that all internal farmOS-map styles should reference. Outside of farmOS-map this variable can be overwritten, ideally at the map wrapper class instead of the global :root since custom CSS properties do inherit.

eg following this, for farmOS core we would need to make this change:

--- a/modules/core/ui/theme/css/map.css
+++ b/modules/core/ui/theme/css/map.css
@@ -1,6 +1,6 @@
 /* Set text color of map control buttons to match SVG color. */
-.farm-map .ol-control button {
-  color: var(--colorGinPrimary);
+.farm-map {
+  --farmos-map-accent-color: var(--colorGinPrimary);
 }

More of the spec is here: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

Copy link
Collaborator

@symbioquine symbioquine left a comment

Choose a reason for hiding this comment

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

Nice! I like this strategy a lot!

@mstenta
Copy link
Member

mstenta commented Oct 24, 2022

Agreed! Great idea!

@symbioquine
Copy link
Collaborator

@paul121 Do you have a screenshot of the fix in place?

@paul121
Copy link
Member Author

paul121 commented Oct 24, 2022

Screenshot from 2022-10-24 08-22-26

@paul121
Copy link
Member Author

paul121 commented Oct 24, 2022

Force push for changelog reference. Thanks for the fast review @symbioquine @mstenta !

@paul121 paul121 merged commit f6b966a into farmOS:2.x Oct 24, 2022
@paul121 paul121 deleted the 2.x-accent-color branch October 24, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix color scheme compliance of remaining icons
3 participants