I have the following code that works fine to set background and foreground colors for a GtkTextview:
static void
setColor(GtkWidget * widget) {
auto style_context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class(style_context, GTK_STYLE_CLASS_VIEW );
auto css_provider = gtk_css_provider_new();
GError *error=NULL;
auto data = g_strdup_printf("\
* {\
background-color: black;\
color: white;\
}\
*:selected {\
background-color: blue;\
color: yellow;\
}\
");
gtk_css_provider_load_from_data (css_provider, data, -1, &error);
g_free(data);
if (error){
ERROR("gtk_css_provider_load_from_data: %s\n", error->message);
g_error_free(error);
return;
}
gtk_style_context_add_provider (style_context,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
The result is that both normal and selected text color have black background and white foreground.
Why doesn't the selected text appear in yellow/blue?
Any pointer to an example file would be much appreciated.
Figured it out. The lack of any tutorials or example led me search the gtk source code for answers. A very complete css file is in the Adwaita theme (gtk-contained.css). From looking through that and a bit of experimenting, the following code will set the foreground and background colors for normal and selected text as specified.
auto data = g_strdup_printf("\
textview text {\
background-color: black;\
color: white;\
}\
.view text selection {\
background-color: blue;\
color: yellow;\
}\
");
The main problem was using the "*". In that same file there is a comment which reads "Wildcards ar bad and troublesome, use them with car, or better, just don't. Everytime a wildcard is used a kitten dies, painfully."
Related
.App {
text-align: center;
** --amenalBlue: #15426C;
--amenalOrange: #D9A460;**
}
h2,h3{
color: gray;
}
/* common table head style */
.tableHead {
*** background-color: var(--amenalOrange);***
}
.tableHead th {
color: var(--amenalBlue);
font-weight: bold;
}
Table head is not taking custom color which i have added but normal hex code is taking. This is happning in MUI table used inside MUI dialog
In ag-Grid when I change the row background color, it is working fine, but when I select the row, the color doesn't change to the blue color so I can recognize that the row is selected.
I'm using gridOptions.getRowStyle to change the row background color:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
The way I would approach it, would be to use the rowClass option in ag-grid.
rowClass: 'my-row'
And then in your css you can define:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
Another option, if you want a custom selected color, would be to use this:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}
if you want to change style of selected row use class in css
.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}
I am aware that I can change the color of the clear-icon and the search-icon as follows:
$searchbar-md-input-clear-icon-color: white;
$searchbar-md-input-search-icon-color: white;
For the cancel-icon, however, this method does not seem to work.
$searchbar-md-input-cancel-icon-color: white;
The code above has no visible effect on the cancel-icon. Instead, the color of the cancel-icon always falls back to the defined primary color.
$colors: (
primary: blue
);
How can I change the color of the cancel-icon?
Yes searchbar-md-input-cancel-icon-color is not a property of SearchBar component.
You need to sets style by a specific css selector like this :
.searchbar-ios-danger .searchbar-ios-cancel {
color: white;
}
I tried following CSS if there is effect of color but I could not change the default white color of the Part.
.MPartStack {
swt-maximize-visible: false;
swt-minimize-visible: false;
swt-mru-visible: true;
swt-tab-outline: false;
}
.MPart {
background-color: black;
border-color: black;
swt-corner-radius: 0;
}
Only Part Stack works and I am unable to see any change reflected from .MPart.
If you create a Composite in the code for your part to need to set it to inherit the background using
composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
otherwise the part Composite will not pick up the MPart style.
An alternative is to set a CSS class for the controls that you create, like this:
WidgetElement.setCSSClass(control, "your-class-name");
i am currently working on a project which is taking an active check feed from Nagios Check_mk and displaying on a text widget. i am trying to get the widget to change colour, working through the workshop page i am stuck with the coffee script, it doesn't appear to have any effect when the value is changed. here is what i have
alert.coffee
class Dashing.Alert extends Dashing.Widget
ready: ->
# This is fired when the widget is done being rendered
onData: (data) ->
# Handle incoming data
# You can access the html node of this widget with #node
# Example: $(#node).fadeOut().fadeIn() will make the node flash each time data comes in.
#accessor 'value', Dashing.AnimatedValue
#accessor 'isTooHigh', ->
#get('value') > 200
alert scss
.widget-alert {
background: #00ff99;
font-size: 65px;
font-weight: bold;
}
.danger {
background: #ff1a00;
}
all other files are exactly as detailed in the workshop page: any help greatly appreciated.
Basically the change of color or animated flashing of color was handled by the scss #keyframe rule, you must bind it to a selector, otherwise the animation will have no effect
Here's some example
$background-alert-color-1: #FFFF66;
$background-alert-color-2: #FF9618;
$text-alert-color: #fff;
#-webkit-keyframes status-alert-background {
0% { background-color: $background-alert-color-1; }
50% { background-color: $background-alert-color-2; }
100% { background-color: $background-alert-color-1; }
}
.widget.status-alert {
color: $text-alert-color;
background-color: $background-alert-color-1;
#include animation(status-alert-background, 2s, ease, infinite);
.icon-alert-sign {
display: inline-block;
}
.title, .more-info {
color: $text-alert-color;
}
For some example and reference (also for the coffescript) you can check this one dashing_zabbix