Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[orx-palette] Add nextColor(2) for easy palette permutations #140

Merged
merged 1 commit into from
Jul 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions orx-palette/src/main/kotlin/PaletteStudio.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class PaletteStudio(
var randomizeKey = 'k'

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 {
NO_SORTING, DARKEST, BRIGHTEST
Expand Down Expand Up @@ -196,6 +204,12 @@ class PaletteStudio(
return paletteIndex
}

val nextColor: ColorRGBa
get() = colors[nextColorIndex]

val nextColor2: ColorRGBa
get() = colors2[nextColor2Index]

fun randomize() {
palette = assemblePalette(colors.shuffled())
}
Expand Down