IssueRaiser

[css-color-5] Add `currentBackgroundColor` Variable

## What `currentBackgroundColor`(or `currentBackground`) would be a variable similar to `currentColor`, the difference being that `currentBackground` is based on the background color rather than the (text) color of the element. ## Use Cases When used with [CSS color functions](https://www.w3.org/TR/css-color-5/), `currentBackground` enables dynamic styling based on the block of color which is predominant in the element. ### Borders and Hover Effects Currently, a popular pattern is to use the currentColor variable for an outline or border on a link or button. Sometimes, this is then swapped on hover. The effect is limited using `currentColor`. Another note is that the color options for foregrounds are often more limited with accessibility being a primary concern. currentBackground enables more subtle dynamic borders without sacrificing accessibility. ![Screen Shot 2020-07-01 at 12 56 02 PM](https://user-images.githubusercontent.com/1693164/86640891-b3318780-bfa8-11ea-8521-12d22e2883f7.png) https://codepen.io/una/pen/BajmGwZ An example with filter cards: ![Screen Shot 2020-11-11 at 12 26 44 PM](https://user-images.githubusercontent.com/1693164/98843637-3a8c7d00-2419-11eb-9f45-875ce3572baf.png) ### Setting Foreground Color `currentBackground` also affords us more flexibility with hover/focus effects, and even allows us to set `currentColor` in a dynamic way. This is also a continuation of the last example where we use currentColor for the borders in the example on the le

Posted by una on Jul 6, 2020, 8:55 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (Other)

[css-color-5] Add `currentBackgroundColor` Variable

unaJul 6, 2020, 8:55 PM

## What `currentBackgroundColor`(or `currentBackground`) would be a variable similar to `currentColor`, the difference being that `currentBackground` is based on the background color rather than the (text) color of the element. ## Use Cases When used with [CSS color functions](https://www.w3.org/TR/css-color-5/), `currentBackground` enables dynamic styling based on the block of color which is predominant in the element. ### Borders and Hover Effects Currently, a popular pattern is to use the currentColor variable for an outline or border on a link or button. Sometimes, this is then swapped on hover. The effect is limited using `currentColor`. Another note is that the color options for foregrounds are often more limited with accessibility being a primary concern. currentBackground enables more subtle dynamic borders without sacrificing accessibility. ![Screen Shot 2020-07-01 at 12 56 02 PM](https://user-images.githubusercontent.com/1693164/86640891-b3318780-bfa8-11ea-8521-12d22e2883f7.png) https://codepen.io/una/pen/BajmGwZ An example with filter cards: ![Screen Shot 2020-11-11 at 12 26 44 PM](https://user-images.githubusercontent.com/1693164/98843637-3a8c7d00-2419-11eb-9f45-875ce3572baf.png) ### Setting Foreground Color `currentBackground` also affords us more flexibility with hover/focus effects, and even allows us to set `currentColor` in a dynamic way. This is also a continuation of the last example where we use currentColor for the borders in the example on the le

Comments (0)

No comments yet. Start the discussion.

Comment on this issue