divyanshub024 / ColorSeekBar

A color picker seekbar for android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set Custom colours

ravikiran18 opened this issue · comments

How to set custom colours for the seek bar

and where is white color 😋 😋

@denzsbs in ColorSeekBar class there is colorSeeds , add white color on that array.

The "colorSeeds" property of this component expects to receive an array by reference.

<com.divyanshu.colorseekbar.ColorSeekBar
android:id="@+id/color_seek_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:colorSeeds="@array/arrColorSeeds" />

In your color xml file, enter your color array, passing each color by reference.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorSeedsOne">#000000</color>
<color name="colorSeedsTwo">#FF5252</color>
<color name="colorSeedsThree">#FFEB3B</color>
<color name="colorSeedsFour">#00C853</color>
<color name="colorSeedsFive">#00B0FF</color>
<color name="colorSeedsSix">#D500F9</color>
<color name="colorSeedsSeven">#8D6E63</color>
<color name="colorSeedsEight">#FFFFFF</color>
<string-array name="arrColorSeeds">
<item>@color/colorSeedsOne</item>
<item>@color/colorSeedsTwo</item>
<item>@color/colorSeedsThree</item>
<item>@color/colorSeedsFour</item>
<item>@color/colorSeedsFive</item>
<item>@color/colorSeedsSix</item>
<item>@color/colorSeedsSeven</item>
<item>@color/colorSeedsEight</item>
</string-array>
</resources>

Cool that you can also put it with less colors. Test it with just two colors to see how cool it is.

<string-array name="arrColorSeeds">
<item>@color/colorSeedsOne</item>
<item>@color/colorSeedsEight</item>
</string-array>