-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Svg color api #9984
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
Svg color api #9984
Changes from 1 commit
84e90e2
98a0113
29ff7ef
ccd70a4
09f591f
d904293
8977c71
9e58859
a24cad1
cd6f00a
59db525
14bc9ff
dccfed8
6194681
6ed8c19
9159ed3
bfc6fc8
37a4d2b
9d94cc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,14 +30,17 @@ | |
| * | ||
| * @returns string the url to the svg api endpoint | ||
| */ | ||
| @function icon-color($icon, $dir, $color, $core: false) { | ||
| @mixin icon-color($icon, $dir, $color, $core: false) { | ||
| // remove # from color | ||
| $index: str-index($color, '#'); | ||
| @if $index { | ||
| $color: str-slice($color, 2); | ||
| } | ||
| $varName: "--icon-#{$icon}-#{$color}"; | ||
| @if $core { | ||
| @return url('#{$webroot}/svg/core/#{$dir}/#{$icon}/#{$color}?v=1'); | ||
| #{$varName}: url('#{$webroot}/svg/core/#{$dir}/#{$icon}/#{$color}?v=1'); | ||
|
||
| } @else { | ||
| #{$varName}: url('#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=1'); | ||
| } | ||
| @return url('#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=1'); | ||
| background-image: var(#{$varName}); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of this invert rule as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, header needs to use the proper urls
Or we need to exclude the variable invert for the header icons :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd say we should exclude those. Their color anyway depends on the theming app color so we should keep that and not invert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, since we're changing the global variables, I'm not sure we can ignore them :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just setting the icon for the header with $color-primary-text instead of $color-white? Then they should not be inverted, if I get the code right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we would have the regular .icon-contacts with $color-white and a header .icon-contacts with $color-primary-text. Yes this will be some duplication, but the icons where this is used are quite limited, so it would be ok i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juliushaertl Of course!!! Great thinking! 👍 🤗