Skip to content

SimpleColorPreference

Marc Auberer edited this page Jan 17, 2021 · 1 revision

Integration of Jaewoong Eum`s ColorPickerPreference lib.

Usage with Kotlin (currently not working yet)

SimpleSettings(this).show {
	Section {
		ColorPref {
	        title = "ColorPreference"
	        summary = "Color Summary"
	        attachAlphaSlideBar = true
	    }
	}
}

Please visit the link to the ColorPickerPreference library above to see all customization options.

Usage with XML

There is also a ColorPickerPreference tag available, which can be used in XML preference configurations.
Here is an example:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
	xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">

	<com.skydoves.colorpickerpreference.ColorPickerPreference
        android:key="color_preference"
        android:title="Color Preference"
        android:summary="Simple Color Preference"
        app:preference_attachAlphaSlideBar="false"
        app:preference_attachBrightnessSlideBar="true"
        app:preference_colorBox_radius="26dp"
        app:preference_dialog_negative="@string/cancel"
        app:preference_dialog_positive="@string/ok"
        app:preference_dialog_title="Toolbar Color"/>
</PreferenceScreen>

Please visit the link to the ColorPickerPreference library above to see all customization options.