From 3aa32868af2b97e1838b09aaadb4bf209ddc17ad Mon Sep 17 00:00:00 2001 From: Astha Patel Date: Wed, 8 Jan 2025 13:59:41 -0500 Subject: [PATCH 1/2] new: change the color of svg --- content/body/img.php | 31 +++++++++++++++++++++++++++++++ images/icons/controls/link.svg | 17 +++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/content/body/img.php b/content/body/img.php index ca569e22..cca56fa2 100644 --- a/content/body/img.php +++ b/content/body/img.php @@ -364,4 +364,35 @@ } ] } + + +

Use Embed to update a SVG

+ + false]); ?> + +

+ Use embed html tag instead image tag to import SVGs. By using embed we can update the color of svg based on color theme. +

+ +
+ +
+ + + \ No newline at end of file diff --git a/images/icons/controls/link.svg b/images/icons/controls/link.svg index e3c76502..a1065a6e 100644 --- a/images/icons/controls/link.svg +++ b/images/icons/controls/link.svg @@ -1,4 +1,21 @@ + From 63aef2c4d2207e21d4583ceff5fa52b05c1dc339 Mon Sep 17 00:00:00 2001 From: Astha Patel Date: Wed, 15 Jan 2025 14:06:20 -0500 Subject: [PATCH 2/2] changes --- content/body/img.php | 8 ++++---- css/img.css | 12 ++++++++++++ images/icons/add-embed.svg | 16 ++++++++++++++++ images/icons/controls/link.svg | 17 ----------------- less/img.less | 15 +++++++++++++++ 5 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 images/icons/add-embed.svg diff --git a/content/body/img.php b/content/body/img.php index cca56fa2..4b091749 100644 --- a/content/body/img.php +++ b/content/body/img.php @@ -150,8 +150,8 @@ A dark blue circle with text inside - - + + I am text in a circle @@ -371,11 +371,11 @@ false]); ?>

- Use embed html tag instead image tag to import SVGs. By using embed we can update the color of svg based on color theme. + To ensure compatibility with Safari and allow dynamic color updates based on the color theme, use the embed HTML tag instead of the img tag to import SVGs. This approach facilitates greater flexibility in styling SVGs directly through CSS or JavaScript

- +
diff --git a/css/img.css b/css/img.css index c26f6404..11d1796a 100644 --- a/css/img.css +++ b/css/img.css @@ -53,6 +53,18 @@ .enable__is-dark-mode .decorative-example__icon { filter: drop-shadow(0px 0px 14px #fff); } +#inline-svg-example .circle { + fill: #00a; +} +.enable__is-dark-mode #inline-svg-example .circle { + fill: #fff; +} +#inline-svg-example .text { + fill: #fff; +} +.enable__is-dark-mode #inline-svg-example .text { + fill: #00a; +} #svg-sprite-example p { text-align: center; } diff --git a/images/icons/add-embed.svg b/images/icons/add-embed.svg new file mode 100644 index 00000000..046ece8c --- /dev/null +++ b/images/icons/add-embed.svg @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/images/icons/controls/link.svg b/images/icons/controls/link.svg index a1065a6e..e3c76502 100644 --- a/images/icons/controls/link.svg +++ b/images/icons/controls/link.svg @@ -1,21 +1,4 @@ - diff --git a/less/img.less b/less/img.less index 0dfd20a6..2235016e 100755 --- a/less/img.less +++ b/less/img.less @@ -54,6 +54,21 @@ } } +#inline-svg-example{ + .circle { + fill: #00a; + .enable__is-dark-mode &{ + fill: #fff; + } + } + .text { + fill: #fff; + .enable__is-dark-mode &{ + fill: #00a; + } + } +} + #svg-sprite-example { p { text-align: center;