Use custom colors with FlatUI
masterYou can implement custom color schemes in two ways:
1. Via XML (Color Arrays)
Define a color array in your colors.xml and an <integer-array> containing the theme colors (typically: darker, dark, primary, and light). Reference this array using the fl_theme attribute in your layout.
2. Via Java
Create an integer array of colors in Java and apply it directly to a widget's attributes (e.g., FlatSeekBar).
<!-- 1. XML Method: Define in colors.xml -->
<color name="custom_theme_darker">#ad843d</color>
<color name="custom_theme_dark">#d4a14a</color>
<color name="custom_theme_primary">#fbbf58</color>
<color name="custom_theme_light">#fae8c8</color>
<integer-array name="custom_theme">
<item>@color/custom_theme_darker</item>
<item>@color/custom_theme_dark</item>
<item>@color/custom_theme_primary</item>
<item>@color/custom_theme_light</item>
</integer-array>
<!-- Reference in layout -->
<com.cengalabs.flatui.views.FlatButton
...
flatui:fl_theme="@array/custom_theme" />// 2. Java Method: Set colors programmatically
int[] myColors = {Color.RED, Color.BLUE, Color.GREEN, Color.BLACK};
((FlatSeekBar) findViewById(R.id.seekbar)).getAttributes().setColors(myColors);