Change font color of elements? #3565
-
Hi Fluent-Community How can I change the font color of FluentUI elements? For example for Switch, Accordion, Button or List? For labels and open accordions, I do this (e.g. in MainLayout.razor) via
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Use the NeutralForeground token. See also https://www.fluentui-blazor.net/DesignTokens and the example code there and temporarily also at https://www.fluentui-blazor.net/issue-tester (which will be removed soon) |
Beta Was this translation helpful? Give feedback.
-
Did you tried updating the |
Beta Was this translation helpful? Give feedback.
-
So I invested some time to find out the best way to change the look of the app at runtime in FluentUI. The need for this functionality arose from the need to create an accessible app. At this point, many thanks to @vnbaaij and @dvoituron for their valuable advice and help. If there are any errors or incorrect conclusions in my handling, please let me know so that I can update this post accordingly. Here is how I programmatically change the visual appearance of the app at runtime: 1. Change Background Blazor JS
2. Change Labels (font color)
**3. Change color of control labels **
4. Change font size
5. Change control color I have implemented the DI in the base class of the app:
I also have the loading and saving of the settings in the base class, because I have to call this functionality from different parts of the app. But I think that because of DI it is not important where this implementation is done.
6. Change mode (dark/light) 7.. Reload page Note:
Because you can change the label color via To create list boxes with Office colors, it is best to use:
Switching back and forth between ENUM and HEX color code is best done in a model (e.g. Settings-model):
The color code as a string in HEX format is therefore in Int__OfficeColor If there are better solutions in one place or another (I can especially imagine OfficeColor <=> HEX code) please post here, then I can adapt my code accordingly. Hope this post can help someone. pc |
Beta Was this translation helpful? Give feedback.
So I invested some time to find out the best way to change the look of the app at runtime in FluentUI. The need for this functionality arose from the need to create an accessible app. At this point, many thanks to @vnbaaij and @dvoituron for their valuable advice and help.
If there are any errors or incorrect conclusions in my handling, please let me know so that I can update this post accordingly.
Here is how I programmatically change the visual appearance of the app at runtime:
1. Change Background
To change the background I use JS. But I am sure that there are better ways in FluentUI. If anyone knows, please let me know.
Blazor
await JSRuntime!.InvokeVoidAsync("setBackgroundColor", Use…