Add Random push/pop + palette colors add via hex strings (#179)
This commit is contained in:
@@ -102,7 +102,7 @@ class PaletteStudio(
|
||||
|
||||
private var onChangeListener = {}
|
||||
|
||||
private fun loadCollection(newCollection: Collections) {
|
||||
fun loadCollection(newCollection: Collections) {
|
||||
val collectionPath: URL = collectionsResource.getValue(newCollection)
|
||||
palettes = mutableListOf()
|
||||
|
||||
@@ -177,6 +177,7 @@ class PaletteStudio(
|
||||
onChangeListener = fn
|
||||
}
|
||||
|
||||
@JvmName("addColorRGBaList")
|
||||
fun add(newPalette: List<ColorRGBa>) {
|
||||
palette = createPalette(newPalette)
|
||||
|
||||
@@ -184,6 +185,15 @@ class PaletteStudio(
|
||||
paletteIndex = palettes.lastIndex
|
||||
}
|
||||
|
||||
@JvmName("addHexList")
|
||||
fun add(hexColors: List<String>) {
|
||||
val newPalette = hexColors.map { ColorRGBa.fromHex(it) }
|
||||
palette = createPalette(newPalette)
|
||||
|
||||
palettes.add(newPalette)
|
||||
paletteIndex = palettes.lastIndex
|
||||
}
|
||||
|
||||
fun loadExternal(filePath: String) {
|
||||
palettes = mutableListOf()
|
||||
|
||||
@@ -222,8 +232,8 @@ class PaletteStudio(
|
||||
palette = createPalette(colors)
|
||||
}
|
||||
|
||||
fun changeCollection(newCollection: Collections) {
|
||||
loadCollection(newCollection)
|
||||
fun newCollection() {
|
||||
palettes.clear()
|
||||
}
|
||||
|
||||
private fun registerKeybindings(keyboard: Keyboard) {
|
||||
@@ -249,4 +259,4 @@ class PaletteStudio(
|
||||
override fun setup(program: Program) {
|
||||
registerKeybindings(program.keyboard)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user