change part of the text color in UiBinder - gwt

I have a text:
<g:Label ui:field="titleLabel">text RedText someMoreText</g:Label>
Now I'd like to make RedText red. I can't set any widget inside <g:Label> tags, or html elements. But how is this done then?

One way is that you can use <g:InlineLable> inside your <g:Lable> and then style the InlineLable with color Red. Or you can use <span> element with an id/class as per requirement and style it accordingly to red color.

Related

How to change the color of rows and text in aggrid on selection

I have a Aggrid and have to change the color of row and text from default blue and black to green and white when we select a row in Aggrid.
I tried making use of this, but the color of links in text does not change to white
It is not related to ag-grid. All you need is to add different CSS rule for links inside a selected row, to override link color (and also, probably, :hover, :active, :focus states).
.ag-row-selected A {
color: while;
}

How to get standard system colours for custom widget

I am writing a custom widget using gtkmm and I would like to use the standard selection colour when part of my widget is selected. For example when you select text in a text box, the background colour goes (for me) dark blue, so I want to obtain this same dark blue colour.
I have tried this, but I only get black or white, not the actual colours in use:
bool MyWidget::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
Gdk::Cairo::set_source_rgba(cr,
get_style_context()->get_color(Gtk::STATE_FLAG_SELECTED));
}
What is the correct way to obtain the standard colours with gtkmm, such that if the user changes their colour theme, the changes will also be reflected here?
Or is it considered best practice to define some new CSS styles which inherit from the standard system ones, so that people can override colours for just my widget if they desire, without affecting others?
Turns out the answer to this is that what I was doing in the question was correct, except there were no styles applied to the widget so the colours were just black and white.
I had to add this in the widget's constructor:
this->get_style_context()->add_class(GTK_STYLE_CLASS_ENTRY);
To get text entry styles. Of course this made render_background() as suggested by ebassi render a text entry background instead, which isn't what I wanted (I just wanted a solid colour.) So instead I changed the above line (in the constructor) to:
this->get_style_context()->add_class(GTK_STYLE_CLASS_DEFAULT);
And in my render function, temporarily set text-entry styles just to get the colour:
auto cxStyle = this->get_style_context();
cxStyle->context_save();
cxStyle->add_class(GTK_STYLE_CLASS_ENTRY);
Gdk::Cairo::set_source_rgba(cr, cxStyle->get_background_color(Gtk::STATE_FLAG_SELECTED));
cr->fill();
cxStyle->context_restore();
This way I was able to obtain the text selection colour and fill a rectangle behind the area of my custom widget that should be shown as currently selected.
I couldn't use render_background() here because it would have drawn the background of a text control which I don't want, I just wanted a solid filled rectangle.
The proper way to render the background of a widget is to use gtk_render_background(). This function will take into account widget state and style.
Your code above becomes:
bool
MyWidget::on_draw (const Cairo::RefPtr<Cairo::Context>& cr)
{
double w = get_allocated_width(), h = get_allocated_height();
Glib::RefPtr<Gtk::StyleContext> context = get_style_context();
context->render_background(cr, 0, 0, w, h);
return true;
}
This way your widget will always be updated to reflect the theme.
If you want to control the color and style of your widget you should use an additional Gtk::StyleProvider for your application to load a custom CSS fragment with the desired style classes.

GWT text with different colors

I had a label that receives a text, example 12 Status 3
I need to put the numbers with a different color.
What is the best way to manage that?
thanks for the help
Every piece of text that you want to be a different color will need its own <Span> tag. This is how StackOverflow and other sites have formatted text inline. You could still use a single <Label> element though, and insert a series of tags.
For example:
/* CSS */
label { color:black; }
.red { color:red; }
.blue { color:blue; }
GWT:
myLabel.setInnerHTML("<span class='red'>12</span> Status <span class='blue'>3</span>");
You can't do this with a single label. You have to use three separate labels, and color each one independently. You probably want to use InlineLabel to keep them all on the same line - I think InlineLabel works just like a <span> tag.
The best way to color a label is with css or CssResource.

Reference for phClr in openxml

I am trying to find value for phClr, but no results.
Slide master is not having mapping for phClr.
I am aware that phClr is just a passed-in color value, but what exactly is its color reference?
Is it bg2 or anything else?
http://msdn.microsoft.com/en-us/library/cc964302(v=office.12).aspx
Blockquote
The scheme color value is set to placeholder color (the value phClr). This value appears throughout the fill, line, effect, and background styles and indicates that the settings are applied to the theme color applicable for a given style. This allows the same fill, line, and effect styles to populate across the theme colors that appear in the OfficeArt galleries.
“phClr” is a kind of placeholder color

How to set "toggle-spacing" style property to GtkMenuItem in gtk+?

How can I set "toggle-spacing" style property to GtkMenuItem in gtk+?
I have added five GtkImageMenuItem(gtk_image_menu_item_new_with_label) to GtkMenu. Now I want to provide spacing between Image and label of this GtkImageMenuItem.
There is a style property (toggle-spacing) in GtkMenuItem to provide spacing between image and label.
How can I use this property?
I want to give alternate colors to each GtkMenuItem. How it is possible?
Kinda menu I want to create is shown in this image.
(source: flickr.com)
Thanks,
KBalar
Setting Properties.
To make the row colors alternate use gtk_tree_view_set_rules_hint.