Class ColorPicker.Builder
- Enclosing class:
ColorPicker
Builds a
ColorPicker; from ColorPicker.builder(String). Also has the options every entry has (Entry.Builder).-
Method Summary
Modifier and TypeMethodDescriptionalpha(boolean alpha) Whether the color has an alpha (opacity) byte the player can edit;falseby default.build()Builds the color picker.A fixed label; seelabel(Supplier).The text before ": #RRGGBB" and the editor's title, re-read on every refresh.onChange(IntConsumer onChange) Stores the color when the player presses Done in the editor; runs on the main thread.value(IntSupplier value) Reads the mod's current color; re-read on every refresh.
-
Method Details
-
label
The text before ": #RRGGBB" and the editor's title, re-read on every refresh. Required.- Parameters:
label- read on refresh- Returns:
- this builder
-
label
A fixed label; seelabel(Supplier).- Parameters:
label- the label- Returns:
- this builder
-
value
Reads the mod's current color; re-read on every refresh. Required.- Parameters:
value- reads0xRRGGBB, or0xAARRGGBBwith alpha- Returns:
- this builder
-
onChange
Stores the color when the player presses Done in the editor; runs on the main thread. Required.- Parameters:
onChange- receives0xRRGGBB(top byte 0), or0xAARRGGBBwith alpha- Returns:
- this builder
-
alpha
Whether the color has an alpha (opacity) byte the player can edit;falseby default. With alpha the editor has a fourth slider, the hex form is#AARRGGBB, and the swatch is drawn translucent.- Parameters:
alpha- whether to edit alpha- Returns:
- this builder
-
build
Builds the color picker.- Returns:
- the picker
- Throws:
IllegalStateException- iflabel,valueoronChangeis missing
-