[orx-palette] Add nextColor(2) for easy palette permutations (#140)
This commit is contained in:
@@ -51,6 +51,14 @@ class PaletteStudio(
|
|||||||
var randomizeKey = 'k'
|
var randomizeKey = 'k'
|
||||||
|
|
||||||
private var paletteIndex: Int = 0
|
private var paletteIndex: Int = 0
|
||||||
|
var nextColorIndex: Int = 0
|
||||||
|
get() {
|
||||||
|
return field++ % colors.size
|
||||||
|
}
|
||||||
|
var nextColor2Index: Int = 0
|
||||||
|
get() {
|
||||||
|
return field++ % colors2.size
|
||||||
|
}
|
||||||
|
|
||||||
enum class SortBy {
|
enum class SortBy {
|
||||||
NO_SORTING, DARKEST, BRIGHTEST
|
NO_SORTING, DARKEST, BRIGHTEST
|
||||||
@@ -196,6 +204,12 @@ class PaletteStudio(
|
|||||||
return paletteIndex
|
return paletteIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val nextColor: ColorRGBa
|
||||||
|
get() = colors[nextColorIndex]
|
||||||
|
|
||||||
|
val nextColor2: ColorRGBa
|
||||||
|
get() = colors2[nextColor2Index]
|
||||||
|
|
||||||
fun randomize() {
|
fun randomize() {
|
||||||
palette = assemblePalette(colors.shuffled())
|
palette = assemblePalette(colors.shuffled())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user