Skip to content

Commit

Permalink
Merge pull request #654 from live-codes/css-icon-fallback
Browse files Browse the repository at this point in the history
add fallback when css masking is not supported
  • Loading branch information
hatemhosny authored Nov 27, 2024
2 parents 04867a1 + b4384a5 commit 540f29e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/livecodes/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
--text-success-bg-color: rgba(85, 255, 0, 0.25);
--text-success-border: 1px solid rgb(85, 255, 0);
--text-success-color: rgb(153, 255, 102);

--icon-filter: invert(0.8);
--icon-filter-active: invert(1);
}

@import 'inc-light';
Expand Down
16 changes: 16 additions & 0 deletions src/livecodes/styles/inc-icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
width: 1em;
}

@supports not (mask-image: var(--svg)) {
[class^='icon-'] {
background-color: transparent;
background-image: var(--svg);
background-repeat: no-repeat;
background-size: 100% 100%;
filter: var(--icon-filter);
}

a:hover [class^='icon-'],
button:hover [class^='icon-'],
[class^='icon-']:hover {
filter: var(--icon-filter-active);
}
}

.icon-add {
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M8 2.5a.5.5 0 0 0-1 0V7H2.5a.5.5 0 0 0 0 1H7v4.5a.5.5 0 0 0 1 0V8h4.5a.5.5 0 0 0 0-1H8z'/%3E%3C/svg%3E");
}
Expand Down
3 changes: 3 additions & 0 deletions src/livecodes/styles/inc-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
--text-success-border: 1px solid rgb(0, 128, 0);
--text-success-color: rgb(0, 178, 0);

--icon-filter: invert(0.3);
--icon-filter-active: invert(1);

#logo img {
filter: drop-shadow(1px 1px 1px var(--color50));
}
Expand Down

0 comments on commit 540f29e

Please sign in to comment.