You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you wants to use `KvColorPalette-Android` to generate your theme color palette when your application start-up, then you have to initiate the library in Application level.
63
-
To initiate you have to pass one base color that you think your application will use. Use following code to initiate the library package.
63
+
There are two ways to initiate the library. These two methods for two different scenarios. First is to initiate the library with one base color and other is to initiate the library with two base colors.
64
+
In two color method, there are additional parameters like `bias` and `themeGenPattern`.
65
+
If your application styling with one base color then you can use following method to initialized,
64
66
````
65
67
override fun onCreate() {
66
68
super.onCreate()
67
69
// Initialize the KvColorPalette-Android
68
-
KvColorPalette.initialize(Color.blue)
70
+
KvColorPalette.initialize(baseColor = Color.blue)
71
+
}
72
+
````
73
+
If your application has two base colors, then you can use following method to initialized,
74
+
````
75
+
override fun onCreate() {
76
+
super.onCreate()
77
+
// Initialize the KvColorPalette-Android
78
+
KvColorPalette.initialize(
79
+
baseColor = Color.blue,
80
+
secondColor = Color.red,
81
+
themeGenPattern = ThemeGenMode.BLEND // The way to generate the theme palette using two colors.
82
+
bias = 0.5f, // How bias to first or second color
83
+
)
69
84
}
70
85
````
71
86
This initiation create a color schemas for a theme using the given color at the initiation. This generated color schemas will available for light and dark theme variants.
* This generate theme-palette with color transparent. This is un-usable.
48
+
* KvColorPalette initialization. Consumer can use this to initialize the KvColorPalette from their application, if they need a
49
+
* Theme color palette at the application start-up.
50
+
*
51
+
* On this initiation of KvColorPalette, library generate a theme color palette using the given base color and second color.
52
+
* `baseColor` and `secondColor` are mandatory parameter while initiate the library. Other two parameters are optional.
53
+
*
54
+
* @param baseColor: Color: Given first for generate theme palette.
55
+
* @param secondColor: Color: Given second color for generate theme palette.
56
+
* @param bias: Float: The bias value to blend the two colors. In default that is 0.5f. This accept float value in a range of 0.0 - 1.0.
57
+
* 0f means full bias to first color and 1f means full bias to second color.
58
+
* @param themeGenMode: ThemeGenPattern: The pattern to generate the theme color palette.
59
+
* Default is [ThemeGenMode.SEQUENCE] and available options are [ThemeGenMode.SEQUENCE] and [ThemeGenMode.BLEND]
60
+
* - [ThemeGenMode.SEQUENCE] will add base color & primary & second color as secondary, rest of the colors will generate by using given base color.
61
+
* - [ThemeGenMode.BLEND] will add base color & primary & second color as primary, rest of the colors will generate by after generating new color blend first and second colors.
* Generate a theme color palette. According to the feeding color,
161
174
* this method generate a color scheme theme color palette.
162
175
*
163
176
* @param givenColor The color to generate the theme color palette for.
177
+
* @param secondColor The secondary color to generate the theme color palette blending with first color.
178
+
* @param bias The bias value to blend the two colors. In default that is 0.5f. This accept float value in a range of 0.0 - 1.0.
179
+
* 0f means full bias to first color and 1f means full bias to second color.
180
+
* @param themeGenMode: ThemeGenPattern: The pattern to generate the theme color palette.
181
+
* Default is [ThemeGenMode.SEQUENCE] and available options are [ThemeGenMode.SEQUENCE] and [ThemeGenMode.BLEND]
182
+
* - [ThemeGenMode.SEQUENCE] will add base color & primary & second color as secondary, rest of the colors will generate by using given base color.
183
+
* - [ThemeGenMode.BLEND] will add base color & primary & second color as primary, rest of the colors will generate by after generating new color blend first and second colors.
164
184
* @return A color scheme theme palette. [ColorSchemeThemePalette]
0 commit comments