I have this css styling for tabpane javafx:
.tab {
-fx-background-color: #002f6c;
}
.tab-pane>*.tab-header-area>*.tab-header-background
{
-fx-background-color: -fx-outer-border, -fx-text-box-border, #002f6c;
}
.tab:selected {
-fx-background-color: #0041a0;
}
.tab-label {
-fx-text-fill: #ffffff;
}
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator
{
-fx-border-radius: 0px;
-fx-border-width: 0px 0px 0px 0px;
-fx-border-color: #4d1a4dff;
}
But i still can't rid of this white border near my tabs:
Can somebody help me with it?
The white border effect is because of the background color insets applied on .tab-header-background. Modifiying the code below should do the trick.
.tab-pane>*.tab-header-area>*.tab-header-background {
-fx-background-color: #002f6c;
-fx-background-insets:0;
}
Related
how do I change the CSS of month label and year label? they are grayish and I want to change to white. I cant find the CSS for these two items.
Current CSS code of this datepicker:
/**
* https://gist.github.com/maxd/63691840fc372f22f470
*/
.calendar-grid {
-fx-background-color: rgb(20, 156, 255);
}
.combo-box-popup > .list-view > .placeholder > .label {
-fx-text-fill: white;
}
.calendar-header {
-fx-background-color: #1d1d1d;
-fx-base: #1d1d1d;
-fx-text-fill: white;
}
.date-picker-popup {
-fx-text-fill: white;
-fx-background-color:
linear-gradient(to bottom,
derive(-fx-color,-17%),
derive(-fx-color,-30%)
),
-fx-control-inner-background;
-fx-background-insets: 0, 1;
-fx-background-radius: 0;
-fx-alignment: CENTER; /* VBox */
-fx-spacing: 0; /* VBox */
-fx-padding: 0.083333em; /* 1 1 1 1 */
-fx-effect: dropshadow( gaussian , rgba(0,0,0,0.2) , 12, 0.0 , 0 , 8 );
}
.date-picker > .text-field {
-fx-text-fill: white;
}
.date-picker-popup > .month-year-pane {
-fx-background-color: #1d1d1d;
-fx-text-fill: white;
}
Change the style for the .month-year-pane to
.date-picker-popup > .month-year-pane {
-fx-base: #1d1d1d ;
-fx-mark-highlight-color: -fx-light-text-color ;
}
By default, -fx-background-color is set to fx-background, which in turn depends on -fx-base. The default text fill for controls whose text is rendered over a background of -fx-background is automatically chosen depending on the intensity of the background; in this case it will be set to -fx-light-text-color (which defaults to white).
The arrows are rendered in -fx-mark-highlight-color, so setting this to -fx-light-text-color ensures the arrows are the same color as the text. (Probably better is to mimic the ladder for -fx-text-fill.)
A lot of your CSS seems to have no effect. With the changes above, this seems equivalent:
.calendar-grid {
-fx-background-color: rgb(20, 156, 255);
}
.date-picker > .text-field {
-fx-text-fill: white;
}
.date-picker-popup > .month-year-pane {
-fx-base: #1d1d1d ;
-fx-mark-highlight-color: -fx-light-text-color ;
}
Note that the rule
.date-picker > .text-field {
-fx-text-fill: white;
}
makes the text in the text field (i.e. the selected date) invisible; I don't know if this is the desired effect.
Looking through the source code I found the labels use the spinner-label style class so I think you can just do:
.date-picker .spinner-label {
-fx-text-fill: white;
}
I'm using TableView in many places in my javaFX application. I'm working on a dark mode theme and want to style this table. Now i can't manage to remove the borders in the header row. Also, the text color in the table rows remains black although the rest of text appears white (because of a dark color for -fx-base in root css class) in my application. The table looks like this:
The css:
.root {
-fx-base:#292929;
}
.table-view {
-fx-background-color: transparent;
-fx-border-color: all-dialog-border-color;
-fx-border-width: 1;
-fx-table-header-border-color: transparent;
-fx-table-cell-border-color: transparent;
-fx-text-fill: white;
}
.table-view .column-header-background
{
-fx-background-color: -fx-base;
}
.table-row-cell
{
-fx-background-insets: 0, 0 0 1 0;
-fx-background-color: transparent;
-fx-text-fill: white;
}
.table-column {
-fx-alignment: CENTER;
}
.table-view:focused .table-row-cell:focused {
-fx-table-cell-border-color: transparent;
}
I want to remove the borders between the columns in the header and make the text in table rows appear white. How do i achieve this?
just play with this Css, it should give you all the customization you want
.table-view{
-fx-background-color: white;
-fx-font-size: 20px;
-fx-border-color: derive(black, -60%);
}
.table-view:focused{
-fx-background-color: derive(-fx-primary, 20%);
}
.table-row-cell {
-fx-cell-size: 40px;
-fx-border-style:solid inside;
-fx-border-width:2;
}
.table-view .column-header-background{
-fx-background-color: white;
}
.table-view .column-header-background .label{
-fx-background-color: transparent;
-fx-text-fill: black;
-fx-text-weight:strong;
-fx-border-style:solid inside;
-fx-border-width:2;
-fx-border-radius:20;
-fx-padding:7;
-fx-font-size:18;
}
.table-view .column-header {
-fx-background-color: transparent;
}
.table-view .table-cell{
-fx-text-fill: black;
-fx-font-size:15;
-fx-alignment:center;
-fx-border-style:solid inside;
-fx-border-width:1;
}
.table-row-cell:focused, .table-cell:focused{
-fx-text-fill: red;
}
.table-row-cell{
-fx-background-color: -fx-primary;
-fx-border-color: black;
-fx-table-cell-border-color: transparent;
}
.table-row-cell:empty{
-fx-background-color:white;
-fx-border-color: transparent;
-fx-table-cell-border-color: transparent;
}
.table-column{
-fx-alignment: CENTER;
}
.table-row-cell:even{
-fx-background-color: derive(white, -10%);
}
.table-row-cell:odd{
-fx-background-color: white;
}
.table-row-cell:even:hover{
-fx-background-color:pink;
}
.table-row-cell:odd:hover{
-fx-background-color: skyblue;
}
.table-row-cell:even:empty{
-fx-background-color: white;
}
.table-row-cell:odd:empty{
-fx-background-color: white;
}
.table-row-cell:selected {
-fx-background-color: black;
-fx-text-fill: white;
-fx-background-insets: 0;
}
.table-row-cell:selected .table-cell{
-fx-text-fill: white;
}
After going through the TableView css suggested by Tule Simon, I realized some css classes were missing.
To remove the border from table header, use:
.table-view .column-header
{
-fx-border-style: none;
}
To make the text in the cells appear white:
.table-cell
{
-fx-text-fill: white;
}
Result:
Currently having a couple issues with JavaFX and CSS stylesheets. I would like to have the selected tab text to be black, and have the non selected tabs to be white. I was able to achieve the background color of the active tab being a darker blue than the rest, but still have an awkward area around the tabs.
Here is the app when it first opens:
First Open
Here is the app when I click on a tab:
First Click
On the second image the text gets completely lost in the background color. If you could help me get rid of the space around the tabs themselves as well that would be awesome too!
Here is my CSS file:
/*main.css*/
/*set individual tab properties*/
.tab {
-fx-background-color: #1c6fb8;
-fx-font: 16px "Helvetica Neue" ;
-fx-background-radius: 0;
}
.tab-label {
-fx-text-fill: #fff;
}
.tab:focused .tab-label {
-fx-text-fill: #000;
}
.tab-header-background {
-fx-background-color: #1c6fb8;
}
.tab-pane {
-fx-tab-min-width:120px;
-fx-tab-max-width:120px;
-fx-tab-min-height:50px;
-fx-tab-max-height:50px;
-fx-background-color: #15558c;
}
.tab:selected {
-fx-text-fill: #000;
-fx-background-color: #15558c;
}
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator {
-fx-background-color: #15558c;
}
Thanks in advance!
Key code:
.tab-pane .tab:selected
{
-fx-background-color: #15558c;
}
.tab:selected .tab-label
{
-fx-text-fill: #000;
-fx-background-color: #15558c;
}
Full code:
.tab {
-fx-background-color: #1c6fb8;
-fx-font: 16px "Helvetica Neue" ;
-fx-background-radius: 0;
}
.tab-label {
-fx-text-fill: #fff;
}
.tab:focused .tab-label {
-fx-text-fill: #000;
}
.tab-header-background {
-fx-background-color: #1c6fb8;
}
.tab-pane {
-fx-tab-min-width:120px;
-fx-tab-max-width:120px;
-fx-tab-min-height:50px;
-fx-tab-max-height:50px;
-fx-background-color: #15558c;
}
/*.tab:selected {
-fx-text-fill: #000;
-fx-background-color: #15558c;
}*/
.tab-pane .tab:selected
{
-fx-background-color: #15558c;
}
.tab:selected .tab-label {
-fx-text-fill: #000;
-fx-background-color: #15558c;
}
First Open:
First Click:
I am currently using CSS to create a dark theme for an application I created. I am having issue creating a dark themed scrollbar, which appears inside a TreeTableView. Most of the scrollbar looks correct, but there is a small extra header created that isn't styled. Here is a picture, of my progress below:
The TreeTableView is very simple. It has two TreeTableColumns.
My current css relating to the table is below:
.tree-table-view
{
-fx-background-color: #404040;
}
.tree-table-view .scroll-bar
{
-fx-background-color: transparent;
}
.tree-table-view *.column-header-background *.show-hide-columns-button
{
-fx-background-color: #404040;
}
.tree-table-column
{
-fx-background-color: #404040;
-fx-border-color: #2d862d;
-fx-border-width: 0px 1px 0px 0px;
}
.tree-table-column .label
{
-fx-border-color: #2d862d;
-fx-border-insets: 0px 5px 0px 5px;
-fx-border-width: 0px 0px 1px 0px;
}
.tree-table-cell
{
-fx-text-fill: #e6e6e6;
-fx-padding: 0px 5px 0px 5px;
}
.tree-table-row-cell .arrow
{
-fx-background-color: #2d862d;
}
Does anyone know what css class I can use to make the white 'extra header' in the top-left corner have a black background? I would really appreciate it.
Any help will be greatly appreciated. Thanks!
.tree-table-view .filler {
}
Was the selector I needed. Thanks JNS!
i'd like to customize the appearance of a Menu in my JavaFX8 application. How can i get rid or style the color of the 'white outline' shown in the following screenshot?
i tryed:
#MainMenuBar
{
-fx-text-fill: #bbbbbb;
-fx-background-color: #3c3f41;
-fx-border-color: #555555;
-fx-border-style: solid;
-fx-border-width: 0 0 1px 0;
}
.menu-item
{
-fx-background-color: #3c3f41;
-fx-text-fill: #bbbbbb;
-fx-border-color: transparent;
}
but it still there is this white otuline.
Thx,
seems you have to also style the 'context-menu'.
it worked by adding:
.context-menu
{
-fx-background-color: #3c3f41;
-fx-border-color: #555555;
-fx-border-style: solid;
-fx-border-width: 1px;
}
This and this answers on SO helped me to figure it out, thanks all.