Skip to content

Commit

Permalink
Use CSS variables for the textLayer highlight colors (PR 15921 foll…
Browse files Browse the repository at this point in the history
…ow-up)

Rather than adding `@media (forced-colors: active) { ... }`-blocks throughout the CSS code, we should utilize CSS variables instead as in our other CSS files.
  • Loading branch information
Snuffleupagus committed Jan 18, 2023
1 parent 42b1cff commit 67b1d15
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions web/text_layer_builder.css
Expand Up @@ -13,6 +13,18 @@
* limitations under the License.
*/

:root {
--highlight-bg-color: rgba(180, 0, 170, 1);
--highlight-selected-bg-color: rgba(0, 100, 0, 1);
}

@media (forced-colors: active) {
:root {
--highlight-bg-color: Highlight;
--highlight-selected-bg-color: ButtonText;
}
}

.textLayer {
position: absolute;
text-align: initial;
Expand Down Expand Up @@ -48,7 +60,7 @@
.textLayer .highlight {
margin: -1px;
padding: 1px;
background-color: rgba(180, 0, 170, 1);
background-color: var(--highlight-bg-color);
border-radius: 4px;
}

Expand All @@ -69,16 +81,7 @@
}

.textLayer .highlight.selected {
background-color: rgba(0, 100, 0, 1);
}

@media (forced-colors: active) {
.textLayer .highlight {
background-color: Highlight;
}
.textLayer .highlight.selected {
background-color: ButtonText;
}
background-color: var(--highlight-selected-bg-color);
}

.textLayer ::selection {
Expand Down

0 comments on commit 67b1d15

Please sign in to comment.