Alright so I can't get this to work at all. I've checked the CSS analyzer in the scene builder and I came to the conclusion that the way to change the text color in a textarea is something similar to this:`
.text-area .text {
-fx-fill: #1e88e5;
-fx-font-size: 32px;
}`
Problem is that the color doesn't change nor does the font size. Where am I going wrong here?
How about this:
.text-area {
-fx-text-fill: #1e88e5;
-fx-font-size: 32px;
}
Update: the Style class text-area doesn't have a descendant named text. it has an immediate child named scroll-pane and a decendant named content .for more information see: this link
Related
Short version: What CSS selector can be used to style the background of a GTK TreeView header?
Long version: I've tried treeview header, treeview header .button, .button, button, label, GtkTreeView header, header and * as selectors for the header of a Gtk.TreeView. Of these, button works to change the colour of the text in the header (the color attribute) but not the background (background-color). label changes the colour of the background behind the header text, but leaves a big area around the text at the default. * works, but of course changes everything else, too.
I've tried to use Gtk Inspector on a simple python example and it reported the treeview class as .view and the button on the header as .button. Setting a custom css provider to the application with:
cssProvider = Gtk.CssProvider()
cssProvider.load_from_path("custom.css")
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
and the custom.css file with the following content:
.view .button { color: Red; background: Cyan; font-weight: bold; text-shadow: none; box-shadow: none; }
The result was:
Here you can see the treeview header with font color as Red and backgroung as Cyan.
Tested on Fedora 23.
EDIT
On Fedora 26, it's as documented. you should use:
treeview.view header button { color: Red; background: Cyan; font-weight: bold; text-shadow: none; box-shadow: none; }
and the result is similar.
I'm working with a Popover, which is used as a tooltip-like help-display for a Textfield.
It contains a Label and a TextArea as content and is created, when the user enters the text field. (Via FocusPropery.addListener )
I apply the style using:
popOver.getRoot().getStylesheets().add(...)
(as found in the documentation documentation )
This works for the TextArea, but only partialy for the label.
My Style looks like this:
*{
-tb-dark-grey: rgb(32,38,44);
}
.root {
-fx-base: -tb-dark-grey;
-fx-background: -tb-dark-grey;
-fx-control-inner-background: -tb-dark-grey;
}
This works very good in my main window. Including all Labels and TextAreas. Everything gets a dark-blue background with white text.
For the Label in the Popover however it changes only the text color to white but the background stays at the usual light grey.
I tried using the TextArea as a workaround. This works for the style. But it always steals the focus from the text field. This makes it impossible to type something. Disabling the TextArea works,but that changes the style of the TextArea.
I already tried appling the style as found in this other question.
I also tried getting the focus back with, which also did not work.
popup.Show(this.inputField)
this.inputField.requestFocus(); // also tried this with Platform.runLater
Your problem should be that Label doesn't use any of the colors you have overwritten in your .root style class. According to JavaFX CSS reference guide you can style the background of a Label by using fx-background-color.
Adding the following line to your stylesheet should do the trick:
.label {
-fx-background-color: -tb-dark-grey;
}
You can also apply the style individually for each label by creating a custom style class if you want to style labels differently:
CSS:
.custom-label {
-fx-background-color: -tb-dark-grey;
}
And then applying it to a specific label:
Label label = new Label("I am a label");
label.getStyleClass().add("custom-label");
Edit: You should probably be aware that your TextArea will not display the exact color you've defined in your stylesheet. If you check the Modena stylesheet, which is the default theme and style for JavaFX (how to find it is described here). You will find the following css for the TextArea content:
.text-area .content {
/*the is 1px less top and bottom than TextInput because of scrollpane border */
-fx-padding: 0.25em 0.583em 0.25em 0.583em; /* 3 7 3 7 */
-fx-cursor: text;
-fx-background-color:
linear-gradient(from 0px 0px to 0px 4px, derive(-fx-control-inner-background, -8%), -fx-control-inner-background);
-fx-background-radius: 2;
}
As you can see. The background color of the TextArea content is not exactly the -fx-control-inner-background that you have defined in your stylesheet, but a linear gradient that goes from a color derived from -fx-control-inner-background to the color you want. This might not even be noticeable for you, but could be good to know.
Setting the color of the TextArea background so that is it precisely your color could be done like this:
.text-area .content {
-fx-background-color: tb-dark-grey;
}
I added an "aside" to the essay "To the Person Sitting in Darkness" here (Miscellaneous tab), but the links appear ghostlike. What inline CSS do I need to add to make those links dark (forestgreen would work, probably)?
In your a link, right after the a, add style="color:green" Substitute "green" for any HEX color you want.
You could manually add "style: color #FFF8DC;" to each of the tags in the aside elements
The Philippine-American War
The more efficient way is to add this style to the stylesheet, not inline on each element.
.aside a {
color: #FFF8DC;
}
Hope that helps!
the problem is that your jqueryUI.css file is applying a darker gray here in line 413:
.ui-widget-content a {
color: #222222;
}
if you remove this line you'll get the a to its normal color style which is #333, applied in your CSS file line 476.
a {
color: #333;
padding-left: 3px;
padding-right: 3px;
text-decoration: underline;
}
if you want a different color to that links specifically then you just need to set this in your CSS:
#MiscTwainContent a {
color:#whatevercoloryouwant
}
With this in mind, no need for using inline-styling, which it is not a good practice.
The simplest way to do it, since the question is just asking about the link text (inside an a / anchor tag) is this:
a {
color: green;
}
Or better yet, per'aps:
a:link, a:visited {
color: green;
}
I am trying to style some text in my Javafx application by making use of css. The effect I am trying to achieve is something like this:
I have the font, but it is just the effect that I am missing. This is what my .css file contains for the text.
.progress-view .title {
-fx-font-family: "Bilbo Swash Caps";
-fx-font-size: 34px;
-fx-text-fill: white;
-fx-blend-mode: darken;
-fx-opacity: 0.8;
-fx-effect: innershadow(gaussian , rgba(0,0,0,0.2),6,0.0,0,2);
}
The effect I have does not look remotely close to this. Also is this achievable by manipulating the effect or something else?
Thanks
Using the following I seem to have gotten the text to look like the second one (bottom) which is good enough for me:
.progress-view .title {
-fx-font: 60px "Bilbo Swash Caps";
-fx-fill: white;
-fx-stroke: black;
-fx-stroke-width: 2;
-fx-blend-mode: darken;
}
Would like to see that smokey effect of the other one though, so post any solutions you found. Thanks!
I am working on a GUI and I've run into a problem. If I set a button, label, or other widget to have a background color, the tooltip for that widget also takes the same background color. I tried editing the style sheet for the tooltip specifically and setting a different background color but it doesn't work. I also tried editing the palette for the widget but changing the color scheme for the tooltip background or text doesn't work either. Is there another way I can do this? I'd like to have consistency between all my tooltips.
Thanks!
You can do something like this to style a QToolTip in general.
QToolTip { color: #fff; background-color: #000; border: none; }
When you need to style QToolTips specifically, based on their parent widget you can use following syntax:
ParentWidgetName QToolTip { color: #333; background-color: #1c1c1c; border: none; }
Reading this will help you further.