Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the color of the range slider in materializecss

I'm using the range slider from here: http://materializecss.com/forms.html

<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.js"></script>

<form action="#">
    <p class="range-field">
      <input type="range" id="test5" min="0" max="100" />
    </p>
  </form>

And I managed to change the color of the "thumb" that pops up when you click on the slider by using this:

input[type=range]+.thumb{
    background-color: #400090;
}

And normally I can just inspect the element on chrome and get what class I have to change to change its color. For some reasons I can't figure out how to inspect the "dot" in the slider to find what class I have to add to change its color.

like image 781
Stupid.Fat.Cat Avatar asked Nov 10 '16 18:11

Stupid.Fat.Cat


People also ask

How do I change the color of my slider range?

If the general appearance of the slider is fine, but the default blue color (in Chrome) needs to fit a theme color, apply a filter: hue-rotate(); to the input[type="range"] element. Other filters can be used. Some even change the background color of the slider.

How do I change the color of a materialized navbar?

You can change color of your navbar by just adding name of color as a class you can pick colors from Colors. If you want the color header of the menu to be same as navbar use . navbar-full class with your <aside> tag.

How do I change the color of materialized CSS?

Materialize comes with a color palette based on the material design base colors. I recommend you to use these to set theme colors, to follow the Material Design color system. thks it works for me. You have to import @import "materialize/components/color-variables"; before setting variables.

How do I change the color of the slider labels?

To change the color of the little "thumbs" on the slider:.range-label { background-color: desired-color; } If you would like to change the grey-color of the background (area outside selection), use this:.noUI-background { background: desired-color; }

How to create a range slider using CSS?

Creating a Range Slider 1 Step 1) Add HTML:#N#Example#N#<div class="slidecontainer">#N#<input type="range" min="1" max="100" value="50" class="slider"... 2 Step 2) Add CSS:#N#Example#N#.slidecontainer {#N#width: 100%; / 3 Width of the outside container 4 /#N#}#N#/ 5 The slider itself 6 /#N#. 7 Step 3) Add JavaScript: More ...

How to change the color of the thumb thumb slider?

You may need to use the !important flag on the property. This changes the color of the slider between the two.thumb elements. To change the color of the little "thumbs" on the slider:.range-label { background-color: desired-color; }

How to create a slider handle icon/image?

Tip: Set the height of the slider to a different value than the slider thumbs if you want unequal heights (15px vs. 25px in this example): To create a slider handle icon/image, use the background property and insert an image url:


1 Answers

This is what I did to change the dot on the slider and the thumb bubble colors.

Screenshot and snippet attached

enter image description here

<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.js"></script>

<style>

  input[type=range]::-webkit-slider-thumb {
    background-color: red;
  }
  input[type=range]::-moz-range-thumb {
    background-color: red;
  }
  input[type=range]::-ms-thumb {
    background-color: red;
  }

  /***** These are to edit the thumb and the text inside the thumb *****/
  input[type=range] + .thumb {
    background-color: #dedede;
  }
  input[type=range] + .thumb.active .value {
    color: red;
  }
</style>
<form action="#">
  <p class="range-field">
    <input type="range" id="test5" min="0" max="100" />
  </p>
</form>
like image 102
Eamonn Gahan Avatar answered Sep 21 '22 15:09

Eamonn Gahan