CSS radio-button label selector - css

I'm trying to modify my radio button using the following criterion:
"No" radiobutton turn red and display 'N' as content when clicked or hovered over
"Yes" radiobutton turn green and display "Y" as content when clicked or hovered over
This is what I have so far: http://jsbin.com/putoz/2/edit
The problem is that I can't find the correct CSS selectors for ".yes-label" and ".no-label" lasses.

What about using the id attribute to distinguish between buttons?
Something like this to change background color on click:
input[id="appointment-yes"]:checked + label:before { ;}
input[id="appoinment-no"]:checked + label:before { ;} (appointment-no is missing a 't'?)
And then change background color during hover with these?
.yes-label:hover:before { ; }
.no-label:hover:before { ; }

Related

Is it possible to make existing icon lighter on hover

For example I've QToolButton with custom icon
Can I make this icon lighter on hover using QToolButton:hover qss?
Could you please try below options:
option 1:
Try PaletteRole property type
http://doc.qt.io/qt-5/stylesheet-reference.html#paletterole
As you require for hovering,
QToolButton:hover { color: palette(light); }
option 2:
Create a different image with lighter view Icon.
And set the background when you hover on it.
QToolButton:hover { background: url("LighterView.png") ; }

Getting rid of pressed effect in JavaFx toggle Button

How can I get rid of the pressed effect of javafx toggle button? Essentially, I want the look and feel of the button to be the same except the background image.
In your CSS file, you can do
.toggle-button:armed {
-fx-color: -fx-base ;
}
You might also want to remove the hover effect:
.toggle-button:armed, .toggle-button:hover {
-fx-color: -fx-base ;
}

JavaFX TableView change selected cell colour

I have a JavaFX TableView and a ListView and they both use custom cell factories. In particular I have overridden updateItem method in order to bind a particular CSS class based on cell value.
This is part of my CSS file:
.tissueCell {
-fx-text-fill: #F5AD11;
}
.tissueCell:selected {
-fx-background-color: #F5AD11;
-fx-text-fill: white;
}
.significantDataCell {
-fx-background-color: yellow;
-fx-text-fill: black;
}
.significantDataCell:selected {
-fx-background-color: white;
-fx-text-fill: black;
}
For the ListView everything work flawlessly: text is displayed with the proper colour and when the cell is selected the text becomes white and the background is filled with proper colour.
I am experiencing problems with the TableView instead. When unselected the text in the cell is displayed with the chosen colour, but when the cell is selected the background is filled with default JavaFX colour for selected table cells background and the text colour remains #F5AD11 (it does not become white).
The same happens with TableCells that use .significantDataCell class. Cells are displayed properly with yellow background and black text, but when selected nothing changes, not event the background this time.
Any ideas? I did a lot of research but couldn't find any working solution.
By default, TableViews do not allow selection of individual cells, but allow selection of rows. Thus the selector .table-cell:selected never matches any cell in the default selection mode. In this case, you would need
.table-row-cell:selected .table-cell {
/* style definitions */
}
or in your scenario
.table-row-cell:selected .tissue-cell {
-fx-background-color: #F5AD11;
-fx-text-fill: white;
}
etc.
If you allow the table to use cell selection, by calling
myTableView.setCellSelectionEnabled(true);
then individual cells become selected on mouse click (etc), and so your original CSS will work.

Setting Background of TextArea

I would like to provide for user possiblity to select color of TextArea:
private void updateTextArea(){
textArea.setStyle("-fx-text-fill: #" + textColor + "; -fx-background-color: #" + backgroundColor);
}
however this doesnt change color of whole background. Ive found on the Internet that to change backgroud of text Area I need to do something like this in external CSS file.
.text-area .content {
-fx-background-color: black ;
}
how Can I do this with setStyle()?
You can do this by fetching the content node out of the TextArea and applying the style to it. But it works only after the TextArea is shown on the stage.
Usage :
Node node = textArea.lookup(".content");
node.setStyle("-fx-background-color: black;");

FullCalendar event text colour change

I added className fc-selected to [any selected day] which took care of my background colour changes for that selected cell. Thinking that I was home free and only needed to change color for the text next, I forcefully removed a few locks of hair when, only way later, did I realize that the date events are not even in the date cell but absolutely positioned above and outside of it.
How can I target the DOM of the events for a selected date in the calendar?
PS: Basically the background color for a date cell goes dark red on selection and I need the title text to temporarily change to white.
You can set an event's
textColor: white or #FFF
http://arshaw.com/fullcalendar/docs/event_data/Event_Object/
You can also set eventTextColor while redering event
http://arshaw.com/fullcalendar/docs/event_rendering/eventTextColor/
Actually, I tried many times and any variations of textColor or eventTextColor didn't worked at all. So, I tried changing color attributes manually;
.portlet.calendar .fc-event .fc-time {
color: white;
}
.portlet.calendar .fc-event .fc-title {
color: white;
}
By using simple javascript like this you can also set font-color of fullcalendar;
var colorStyle = document.getElementsByClassName('fc-title');
for (var i=0; i<colorStyle.length; i++) {
colorStyle[i].style.color = 'white';
}

Resources