Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting custom CSS rules for SVG. (#1210)
* Support setting custom CSS rules for SVG. * Update API. * Remove.
- Loading branch information
1 parent
d6ec2fe
commit c1adab8
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@file:Suppress("UNCHECKED_CAST") | ||
@file:JvmName("Svgs") | ||
|
||
package coil.request | ||
|
||
import coil.decode.SvgDecoder.Companion.CSS_KEY | ||
|
||
/** | ||
* Specifies additional CSS rules that will be applied when rendering an SVG in addition to any | ||
* rules specified in the SVG itself. | ||
*/ | ||
fun ImageRequest.Builder.css(css: String): ImageRequest.Builder { | ||
return setParameter(CSS_KEY, css) | ||
} | ||
|
||
/** | ||
* Get the additional CSS rules. | ||
*/ | ||
fun Parameters.css(): String? = value(CSS_KEY) |