Styling Moodle SVG Icons in Moodle 3.2.1

Re: Styling Moodle SVG Icons in Moodle 3.2.1

by Rafael Maragato -
Number of replies: 5

I also tried this:

[alt=" Toggle notifications menu "] { background: white!important; }

And the background worked but the "fill" option on the svg didn't. I guess because i couldn't identify what the correct path for the img :/

In reply to Rafael Maragato

Re: Styling Moodle SVG Icons in Moodle 3.2.1

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Here is the link to the discussion where I found a solution for a similar request.

https://moodle.org/mod/forum/discuss.php?d=349402#p1409794

The alternative is find the SVG images and copy them from moodle/pix/i/messages.svg and moodle/pix/t/notifications.svg 

Then place them in a folder in the root directory of your theme. Name this new folder pix_core

and add the images into their respective folders I and t

so so the list of directories is as follows:

moodle/

   theme/

       yourtheme/

           pix_core/

               i/ notifications.svg

               t/ messages.svg

Here is the fun bit...

using Notepad open the svg files and find the part of the code that says

fill: #999999;

here is source code for the svg file

https://github.com/lazydaisy/moodle/commit/43f5b288c22be067d769bb7c0df501fb7ce70d0a

and change to

fill: #ffffff;

Save and then check to see if the images change color. if not then do a Purge all caches 

If it doesn't work then the images that are being used are not svg they will be png or  gif 

hope it helps?

Mary

Average of ratings: Useful (2)
In reply to Mary Evans

Re: Styling Moodle SVG Icons in Moodle 3.2.1

by Rafael Maragato -
Hello Mary smile

Thanks for the tips. In my case i cant change the SVG file directly cause it will turn the icon of notification or message in white on all the system so i have to do it by css only in the menu... unfortunately i didnt find the way to the svg image to use the fill attribute correctly :/

If i have succeed i'll post here Yes

Cheers,

Tics
In reply to Rafael Maragato

Re: Styling Moodle SVG Icons in Moodle 3.2.1

by David Scotson -

Hi Rafael,


you could try

filter: brightness(1.5)

to make the gray icons whiter via CSS.

You might need to add -webkit-filter for support on some browser, and it won't work on IE11, but might be handy in some situations.

Average of ratings: Useful (3)
In reply to David Scotson

Re: Styling Moodle SVG Icons in Moodle 3.2.1

by Rafael Maragato -
Hello Dave, Hello Mary, Hello David and other guys big grin

With your help and the great suggestion of David i solved this question.

I put in the theme_clean |customcss (http://your_ip_address/moodle/admin/settings.php?section=themesettingclean):

/* Top menu - Icon colors - White - Notifications and Messages */

[alt=" Toggle notifications menu "] { filter:brightness(1.5)!important; }
[alt=" Toggle messages menu "] { filter:brightness(1.5)!important; }



This solve the problem with the replace of the image in all the other places in the system. Very nice!



Thank you guys!

Tics