Is it possible to change the color of a MaterialDesignIcon? - gluon-mobile

I use a MaterialDesignIcon in a label like this:
Label info = new Label("Label", MaterialDesignIcon.AC_UNIT.graphic("-fx-fill: red;"));
I don't know what CSS is supports (https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html) but I thought it was Text. -fx-underline worked and so did -fx-font-size. I understand that other font properties don't always work because the font doesn't support them, so that's fine. None of the Shape properties worked so the above fill doesn't do anything.
I only see the colors change by the Swatch but I want something local. What CSS properties are supported and how can I change a single icon's color?

MaterialDesignIcon.graphic() creates an instance of Label. So to change its color you can use fx-text-fill: red.
To inspect your GUI you can use ScenicView

Related

UIButton image tint not working

One of my apps has three UIButtons on it, and they use images that I got from icons8. In the code, I change the tint color and it works fine. Whatever I set the tint color to is what color the button image becomes that color.
Today I wanted to add a fourth button to mute sound. I downloaded the images that I wanted from icons8, added the button and set it up like I have the rest of the buttons set up. The new button is not changing colors like the rest of them. I'm certain that it has to do with the image, because if I select a different image, it changes color. I also tried using the new image on one of the older buttons and it would not change color.
My question - is there anything special that needs to be done to an image to make it work with tint color?
Try setting the image to render as a template image. You can do this in your .xcasset folder selecting the image set, opening the attributes inspector and setting render as to "template image."
What I did was follow the #beyowulf instructions and on the code I just did this
yourBtn.tintColor = .white (or other color)
this worked for me

Color slightly different when reapplying it programmatically [duplicate]

I have really weird problem with colors in interface builder. I set a color on one UI element, for example UIView, and then I want the same color on UIButton...but when I try to do so, colors are often different - I mean little bit different tone, not absolutely different color. How is this even possible ??? I've tried to use RGB sliders, and other sliders, also that color picker tool... Only thing that helps me sometimes is, when I create new UI element. Anybody had the same problem and knows what's going on ?
Interface Builder filters colors through your monitor's current color space by default. You can change this in Xcode4 IB by bringing up a Colors dialog, clicking the Sliders tab, then clicking the little dropdown button under the magnifying glass that looks like a color spectrum. This will bring up a list of available color spaces -- select Generic RGB and adjust the sliders as necessary to get the correct color.
See this question for more information, especially the comments on the accepted answer.
I solved this issue using "Device RGB" instead "Generic RGB".
See the image:
Unfortunately, fiddling with color spaces didn't work for me. What did work was editing the raw xml of the .xib (right click .xib, Open As > Source Code) and changing the RGB decimal values there.
The currently selected item in interface builder will be slightly different to its actual colour - it has a darkened mask applied to it to highlight the fact that it is selected. You need to click somewhere else in the window to unselect the item, it's real colour will then be shown. I've fallen into this trap myself.

Modifying JvTabBar with JvTabBarXPPainter

I tried to modify properties of JvTabBar, but it does not work. I assigned JvTabBarXPPainter to JvTabBar, but it only changed "FixedTabSize" properties. All the other cannot be changed. What interests me is to change the background color and font.
You can use TJvModernTabBarPainter and assign it to the JvTabBar. It allows you to modify all properties. The XP-Painter paints with the theming API and you can't change its colors unless you change the XP theming style system wide.

Styling a menubar item (Firemonkey)

I can't seem to figure out how to change the font of a tmenuitem object.
I add a menubar, and add a item to it.
I create a customstyle for the menuitem.
I can change the background color and stroke color etc,etc, but I can NOT change the font of the text part.
If I change the font (size or name or anything) it shows in the style editor but does not show in the form designer or at runtime.
Seems the font somehow default to something.
Has anyone else been able to do this ?
FireMonkey overwrites pretty much any settings you make for fonts (face, size, style) within a style. AFAIK any font changes you want to make have to be done at run time. In the case of a TMenuItem that means by setting the Font property manually after you have created the menu item.
However (and I've never played with this) I seen people saying they can change a font by setting the StyleLookup after a component has been created.
You might want to hook into the OnApplyStyleLookup event to make these updates.

How to change the color of some text in textbox - Silverlight 3?

I have a usual TextBox. I know in order to change the color of some text I can use Run tag. But when I try to use it imperatively instead declaratively (because I need to do that dynamically) I have the text in TextBox like
AAA<Run...>Text to be changed in color</Run>
and sure nothing in color changes.
How can I change the color of some text in some program way?
Thanks
I'm fairly sure you have to use a RichTextBox for that, TextBox only works with plaintext.

Resources