Ways to customize the selected item's color in md-select using Angular Material?

Currently, I am utilizing the dark theme in angular-material 1.0.4. The appearance of the select element is different when an item is selected:

https://i.sstatic.net/FRU0r.png

Comparatively, this is how it appears with the default theme applied:

https://i.sstatic.net/3fn1M.png

The dark theme fails to handle color effectively. How can I modify the background color of the selected item (shown as light grey in the images) or alter the text color of the item?

I solely employ the default CSS:

<link rel="stylesheet" href="lib/angular-material/angular-material.css">

This is the setup of the select element:

        <md-input-container flex="30">
            <label>Branch</label>
            <md-select ng-model="selectedBranch">
                <md-option ng-repeat="b in branches" value="{{b.id}}">
                    {{b.name}}
                </md-option>
            </md-select>
        </md-input-container>

Below is how I initialize the dark theme:

app.config(function ($mdThemingProvider) {
    $mdThemingProvider.theme('default')
        .dark()
        .primaryPalette('orange')
        .accentPalette('yellow')
        .warnPalette('deep-orange');
});

REMARK: Simply changing the color on mouse hover does not solve the issue, as keyboard selection is also possible.


UPDATE: Ultimately, determining that the event responsible for coloring the text is "focus" resolved the problem.

Answer №1

md-option:hover{
  color: black; 
}

That solution should work like a charm.

Answer №2

Check out this solution:

md-option:focus{
    color: black;
}

Answer №3

md-option ._md-text{
 font-color:lime;
}

or (depending on the version)

md-option .md-text{
        font-color:lime;
}

selector with icon:

md-select ._md-text{
        font-color:white;
}

//drop down icon:
md-select ._md-text{display:inline}._md-select-value ._md-select-icon{
        font-color:white;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to display an icon upon hovering or clicking, then conceal it when the mouse is moved away or another list item is clicked using ngFor in Angular 7

Within a simple loop, I have created a list with multiple rows. When a row is clicked or hovered over, it becomes active. Subsequently, clicking on another row will deactivate the previous one and activate the new one. So far, everything is functioning c ...

Mobile Website Blog Page With Dual Sidebars Issue

I have created a blog page using bootstrap 4 that features both left and right sidebars along with the main content section. Everything looks great on Desktop view. However, when viewed on a mobile phone, the order changes to: left-sidebar>content> ...

When text exceeds multiple lines, display an ellipsis to indicate overflow and wrap only at word boundaries

Here is an example snippet of my code: <div class="container"> <div class="item n1">Proe Schugaienz</div> <div class="item n2">Proe Schugaienz</div> </div> and I am using the following jQuery code: $(&apos ...

Having trouble with overriding an @media query for material-ui react components?

I've been trying to modify a @media CSS rule on a Material UI component, similar to the discussions on How to over-ride an @media css for a material-ui react component and Override components like MuiTab that use media queries. However, I have not bee ...

Set the minimum height of a section in jQuery to be equal to the height of

My goal is to dynamically set the minimum height of each section to match the height of the window. Here is my current implementation... HTML <section id="hero"> </section> <section id="services"> </section> <section id="wo ...

Is it possible to control my CSS using ModX Resources?

I have recently been experimenting with the ModX Revolution manager and had a question about converting my CSS into ModX Resources instead of files. I am interested in utilizing Templates and their variables as well. Do you know if this is possible? Also, ...

Image Carousel Extravaganza

Trying to set up a sequence of autoplaying images has been a bit of a challenge for me. I've attempted various methods but haven't quite nailed it yet. Take a look at what I'm aiming for: https://i.stack.imgur.com/JlqWk.gif This is the cod ...

Exploring nested selection with css and utilizing the ::focus pseudo class

Is it possible, using CSS, to target the helpTextInvalid class when the div element with the selectize-input class is in focus? <html> <head> <body> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/lib ...

Updating form state in AngularJS immediately after programmatically changing a scope variableIs this good enough?

Whenever I'm testing my app, I have a developer button on my form that saves me from entering the same data repeatedly. This special button triggers the fakeSubmit() function which automatically fills out the form for me. The fakeSubmit() function si ...

What is the best way to eliminate an item from an array in JavaScript or AngularJS?

I'm attempting to eliminate objects from an array and retrieve the resulting array. I've been using a remove function, but it's not functioning as expected. Here is the input I'm working with: The goal is to remove all values in the ar ...

Sending a file input to a Node.js server from an Angular service call

I have a basic multipart formdata that needs to be posted to a server running on node.js. <form action="/upload" enctype="multipart/form-data" method="post"> <span class="btn btn-file"> <input type="file" name="file" ng-model= ...

Angular background image not displayed

After searching extensively, I came across many examples that didn't work for me. I'm not sure what I'm doing wrong and I need assistance! I noticed that I can see the image if I use the <img> tag, but not when I try to set it as a ba ...

Is it possible to write CSS 3 rows without using the :not() selector for improved efficiency?

Consider using CSS code like the following in some cases: input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]) { border:1px solid #fff; background-color:#f3f4f5; } <div><input type="text" name="alpha" /&g ...

Ensuring the sort icon is constantly displayed in MudDataGrid

Is there a way to keep the sort icon visible at all times in mudgrid without any default sorting using mudblazor? I have implemented the advanced data grid from the following link:- I have attempted using sortable=true on both the column and datagrid but ...

Validating Color Properties with CSS 3.0

When using Visual Studio 2012 (Ultimate), a red squiggly may appear indicating that rgba(255, 255, 255, 0.4) is not a valid color property value However, according to the W3C, it is considered a valid value. Could this be a bug in Visual Studio, or am ...

"Within Angular 2+, the attribute referenced is not recognized as a valid property, even though it is explicitly defined within the @Input

The main goal here is to increase the vertical pixel count. <spacer [height]="200"></spacer> Initially facing an issue where an error message states that height is not a recognized attribute of spacer. To address this problem, I set up the fo ...

In what ways can the Material-UI theme be customized to modify the font size of labels for TextFields, Menu dropdowns, and Autocomplete components within a React application?

Currently, I am in the midst of a React project and using Material-UI to style my components. My goal is to modify the theme by adjusting the font size of certain labels such as Text Field labels, Menu dropdown labels, and Autocomplete labels. Despite my ...

Internal server error encountered while making an AJAX call using AngularJS routing

I'm currently diving into AngularJS with a basic application focused on customers and their orders. The issue I'm encountering involves a table that showcases the list of customers along with a link to access their respective orders. However, upo ...

"Enjoying a table header that scrolls freely with autoscroll feature

Resolved - http://jsfiddle.net/CrSpu/11704/ I'm facing an issue with a table that has autoscroll functionality. I am looking to freeze the header of the table when automatic scrolling occurs, or you can test it out using my code pen. I'm uncer ...

The PUT Method encounters errors when the model string contains a value that interacts with the web API

Here is a webapi method that I am working with: // PUT api/Competitions/5 public HttpResponseMessage PutCompetitor(int id, CompetitionViewModel competitorviewmodel) { ... } The structure of the CompetitionViewModel is as follows: public class Compe ...