Changing Icon Colours

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
Vagulus
Posts: 853
Joined: Tue Jul 14, 2020 7:55 am
Location: Perth, Western Australia

Changing Icon Colours

Post by Vagulus »

I am using a 'Dark' Stylesheet in
OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/New Zealand (en_NZ)
You can see what it looks like in the GUI image attached.

I use this style because I have found that glaring white (and Blue) GUIs (in the Microsoft fashion) give me screaming headaches at the end of a shift. Blame that on my fading, geriatric eyesight if you like but it is unpleasant and unnecessary. However, this solution raises another issue (You get nothing for nothing, eh!) in that the Sketcher Constraints toolbar (on the right of my GUI) is difficult to distinguish.

How can I change the icons on the Sketcher Constraints toolbar so they are similar to the icons on the Sketcher Geometries toolbar? For example, I would like the Coincident Constraint Icon Image to be predominantly white like the Sketcher Circle Icon Image.
Attachments
210901 FreeCAD GUI.png
210901 FreeCAD GUI.png (290.05 KiB) Viewed 2088 times
"It is much harder to simplify than to complicate."
Joseph Kimble
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Changing Icon Colours

Post by TheMarkster »

You probably won't like this answer because it involves a lot of work. Perhaps someone will have a better way.

One way to do this could be to create a macro to do the constraint. Perhaps just have it simulate a keystroke that invokes the macro. For example, C key does the coincident constraint. When you run the macro it presses C for you and that runs the constraint. Create a custom macro toolbar for sketcher workbench, add the macro to it, create your own toolbar icon that meets your satisfaction for the macro. I believe it is possible (but I haven't tried it) to remove the coincident constraint from the sketcher constraints toolbar. Do this for all of the constraints.

Here is a macro for the Coincident Constraint (sends a 'c' keystroke to the active window):
sendkey.FCMacro
(371 Bytes) Downloaded 30 times
User avatar
Vagulus
Posts: 853
Joined: Tue Jul 14, 2020 7:55 am
Location: Perth, Western Australia

Re: Changing Icon Colours

Post by Vagulus »

Thanks for the idea.

That would mean that I could apply the constraints without having to distinguish the icons on the Sketcher Constraints toolbar. Yes.
I am not scared of the work involved in writing 19 macros. No.
However, if I can I think I would prefer a different set of Icons. 8-)
"It is much harder to simplify than to complicate."
Joseph Kimble
chrisb
Veteran
Posts: 54291
Joined: Tue Mar 17, 2015 9:14 am

Re: Changing Icon Colours

Post by chrisb »

There are other icon sets around, did you try one of these?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Vagulus
Posts: 853
Joined: Tue Jul 14, 2020 7:55 am
Location: Perth, Western Australia

Re: Changing Icon Colours

Post by Vagulus »

chrisb wrote: Wed Sep 01, 2021 6:32 am There are other icon sets around, did you try one of these?
I expected to be able to find a folder of icon images somewhere in the FC Installation. There is no such and Uncle Google knows nothing about such a folder. If there was one I would have had a go at modifying the icons locally and, if successful, would not have started this thread in the first place.

There are 'Icon Themes' at https://github.com/triplus/IconThemes#v ... ecommended but I find the information there a bit circular. I am told 'This module can be installed via the FreeCAD Addon Manager. In FreeCAD, Open Tools > Addon Manager and search for "IconThemes" in the list.' I go there and install 'Icon Themes;

I now have 'Accessories --> Icon Themes'
210902 Icon Themes.png
210902 Icon Themes.png (16.29 KiB) Viewed 1988 times
but that doesn't get me very far. :cry:

Is it these 'Icon Themes' you are talking about when you say 'Icon Sets'?
If so, how do I see them, select one, install one, etc.?
If not, where are these 'Icon Sets'?
"It is much harder to simplify than to complicate."
Joseph Kimble
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Changing Icon Colours

Post by TheMarkster »

Vagulus wrote: Wed Sep 01, 2021 5:58 am Thanks for the idea.

That would mean that I could apply the constraints without having to distinguish the icons on the Sketcher Constraints toolbar. Yes.
I am not scared of the work involved in writing 19 macros. No.
However, if I can I think I would prefer a different set of Icons. 8-)
If you need the shift key use, for example:

Code: Select all

sendkeys(ord('H'),QtCore.Qt.ShiftModifier) #Shift + H
Or replace ShiftModifier with one of these for other modifier keys.

control key:
QtCore.Qt.ControlModifier

alt key:
QtCore.Qt.AltModifier

You can also create easier-to-type aliases:

Code: Select all

shift = QtCore.Qt.ShiftModifier
ctrl = QtCore.Qt.ControlModifier
alt = QtCore.Qt.AltModifier
ctrl_shift = QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier

sendkeys('h', shift) # to send shift+h
sendkeys('c') # to send c
sendkeys('k',ctrl) # to send control + k
sendkeys('x',ctrl_shift) # to send ctrl + shift + x
When I said it was a lot of work, I was thinking mostly of creating all the custom icons and setting up the custom toolbar and adding all the macros to it. Some constraints might not already have keyboard shortcuts, but you should be able to add shortcuts to those that do not already have them.

I wish we could embed macro toolbar icons into the macro in XPM format.

You can find the sketcher icons here:

https://github.com/FreeCAD/FreeCAD/tree ... rces/icons

Most, if not all, workbenches have their icons organized the same way -- inside the Gui/Resources folder in the source code.
User avatar
Vagulus
Posts: 853
Joined: Tue Jul 14, 2020 7:55 am
Location: Perth, Western Australia

Re: Changing Icon Colours

Post by Vagulus »

Thanks for that. Now I know where to find the SVG files although I have yet to find a way to edit them.

Even if I have a suitably edited set, how would I get them to display in my GUI?
"It is much harder to simplify than to complicate."
Joseph Kimble
User avatar
Vagulus
Posts: 853
Joined: Tue Jul 14, 2020 7:55 am
Location: Perth, Western Australia

Re: Changing Icon Colours

Post by Vagulus »

[quote=Vagulus post_id=529796 time=1630548837 user_id=35139
I now have 'Accessories --> Icon Themes'
[/quote]

I forgot to point out that the Icon Themes image I showed is just that - an image in my GUI. It does not react in any way.
"It is much harder to simplify than to complicate."
Joseph Kimble
Bance
Veteran
Posts: 4274
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Changing Icon Colours

Post by Bance »

Vagulus wrote: Thu Sep 02, 2021 3:07 am Thanks for that. Now I know where to find the SVG files although I have yet to find a way to edit them.

Even if I have a suitably edited set, how would I get them to display in my GUI?
Did you read the Readme at github?
https://github.com/triplus/IconThemes#via-addon-manager-recommended wrote: For the demonstration purposes demo.rcc icon theme was provided.

Move the demo.rcc to the appropriate location:

On Linux: /home/user_name/.FreeCAD/Gui/Icons/demo.rcc
On MacOS: /Users/user_name/Library/Preferences/FreeCAD/Gui/Icons/demo.rcc
On Windows: C:\Users\user_name\AppData\Roaming\FreeCAD\Gui\Icons\demo.rcc

Note: The folder might not exist, but you can create them manually

You can then open the icon themes preferences in FreeCAD (Accessories > IconThemes) and choose the icon theme.
chrisb
Veteran
Posts: 54291
Joined: Tue Mar 17, 2015 9:14 am

Re: Changing Icon Colours

Post by chrisb »

I had meant indeed "Icon Themes". However, I have never installed one myself. From what I see what you installed from the AddonManager was only the framework. In the Usage section of this addon it is explained how to add an icon theme then.

Edit: Fast Bance was, well, faster.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply