A modern color-picker library for Android, which is compatible with Jetpack Navigation and Jetpack Compose.
The library is generally available on JitPack; either by version tag or master-SNAPSHOT.
The JitPack repository URL would be: maven { url 'https://jitpack.io' }
dependencies { implementation "io.syslogic:androidx-colorpicker:1.2.9" } The :mobile application module provides these usage examples:
a) Use ColorPickerDialogFragmentImpl extends ColorPickerDialogFragment:
class ColorPickerDialogFragmentImpl extends ColorPickerDialogFragment { public ColorPickerDialogFragmentImpl() { super(); } }Then define ColorPickerDialogFragmentImpl as navigation destination in nav_graph.xml:
<dialog android:id="@+id/colorPickerDialogFragment" android:name="io.syslogic.demo.colorpicker.fragment.ColorPickerDialogFragmentImpl"> <argument app:argType="integer" android:name="initialColor" android:defaultValue="-16777216"/> <argument app:argType="boolean" android:name="alphaSlider" android:defaultValue="false"/> <argument app:argType="boolean" android:name="hexValue" android:defaultValue="false"/> </dialog>Screenshot ColorPickerDialogFragment:
b) ColorPickerPreference can be added as XML node; into eg. preferences.xml:
<io.syslogic.colorpicker.ColorPickerPreference android:title="@string/text_select_color" android:icon="@drawable/ic_baseline_invert_colors" android:defaultValue="@string/value_default_color" android:key="color_code_01"/>c) Preview: @Composable fun ColorPickerComponent
d) Preview: @Composable fun ColorPickerDialog


