How can I set the background color of in a element?
select.list1 option.option2 { background-color: #007700; } <select class=”list1″> <option value=”1″>Option 1</option> <option value=”2″ class=”option2″>Option 2</option> </select>
select.list1 option.option2 { background-color: #007700; } <select class=”list1″> <option value=”1″>Option 1</option> <option value=”2″ class=”option2″>Option 2</option> </select>
To expand on @DaneWhite’s answer, you don’t have to rely on the built-in themes. You can easily supply your own style: <style name=”MyDialogTheme” parent=”Theme.AppCompat.Light.Dialog.Alert”> <item name=”android:background”>@color/myColor</item> </style> and then apply it in the Builder constructor: Java: AlertDialog alertDialog = new AlertDialog.Builder(getContext(), R.style.MyDialogTheme) … .create(); Kotlin: var alertDialog = AlertDialog.Builder(context, R.style.MyDialogTheme) … .create() This should work … Read more
This can only be accomplished in API 11+ if your background is a solid color. int color = Color.TRANSPARENT; Drawable background = view.getBackground(); if (background instanceof ColorDrawable) color = ((ColorDrawable) background).getColor();
Use,.. Color.parseColor(“#bdbdbd”); like, mTextView.setTextColor(Color.parseColor(“#bdbdbd”)); Or if you have defined color code in resource’s color.xml file than (From API >= 23) mTextView.setTextColor(ContextCompat.getColor(context, R.color.<name_of_color>)); (For API < 23) mTextView.setTextColor(getResources().getColor(R.color.<name_of_color>));
You can not modify UISwitch control unless and until you write your own control, But best way so far, you can used UISegmentControl and handle event on it to switch the on.png and off.png images. UISegmentedControl* switchView=[[UISegmentedControl alloc] initWithItems:[[[NSMutableArray alloc] initWithObjects:@”On”,@”Off”,nil] autorelease]]; [switchView setFrame:CGRectMake(20,365,140,28)]; switchView.selectedSegmentIndex=0; switchView.segmentedControlStyle=UISegmentedControlStyleBar; [switchView setImage:[UIImage imageNamed:@”onSelected.png”] forSegmentAtIndex:0]; [switchView setImage:[UIImage imageNamed:@”off.png”] forSegmentAtIndex:1]; [switchView … Read more
This is now possible with custom properties: .brown { –rgb: 118, 76, 41; } .green { –rgb: 51, 91, 11; } a { display: block; position: relative; } div { position: absolute; bottom: 0; background-color: rgba(var(–rgb), 0.8); } a:hover div { background-color: rgba(var(–rgb), 1); } To understand how this works, see How do I apply … Read more
I used a simple layer of background colors to produce a red highlight (similar to Stefan’ suggested solution). /** * file: table.css * Place in same directory as TableViewPropertyEditorWithCSS.java. * Have your build system copy this file to your build output directory. **/ .highlighted-cell { -fx-text-fill: -fx-text-inner-color; -fx-background-color: firebrick, gainsboro; -fx-background-insets: 0, 2 0 0 … Read more
The child views in your list row should be considered selected whenever the parent row is selected, so you should be able to just set a normal state drawable/color-list on the views you want to change, no messy Java code necessary. See this SO post. Specifically, you’d set the textColor of your textViews to an … Read more
mask combined with linear-gradient can do it: .box { height: 200px; width: 300px; background: linear-gradient(to right, rgb(238, 252, 83), rgb(120, 239, 197)) } .box::before { content: “”; display: block; height: 100%; background: linear-gradient(to right, rgb(253, 67, 205), rgb(74, 68, 215)); -webkit-mask: linear-gradient(to bottom,#0000, #000); mask: linear-gradient(to bottom,#0000, #000); } <div class=”box”></div> Another kind of coloration: … Read more
var div = document.getElementById( ‘div_id’ ); div.onmouseover = function() { this.style.backgroundColor=”green”; var h2s = this.getElementsByTagName( ‘h2’ ); h2s[0].style.backgroundColor=”blue”; }; div.onmouseout = function() { this.style.backgroundColor=”transparent”; var h2s = this.getElementsByTagName( ‘h2’ ); h2s[0].style.backgroundColor=”transparent”; };