A color picker bottom sheet
ColorSheet
A color picker bottom sheet.
implementation "dev.sasikanth:colorsheet:1.0.0"
Usage
Default color sheet, it will show grid of colors
ColorSheet().colorPicker(
colors = colors,
listener = { color ->
// Handle color
})
.show(supportFragmentManager)
Color sheet with "no color" option
ColorSheet().colorPicker(
colors = colors,
noColorOption = true,
listener = { color ->
// Handle color
})
.show(supportFragmentManager)
With this you will get a no color option at start, when user selects this it will return ColorSheet.NO_COLOR.
To mark the color as selected in color sheet, specify selectedColor in colorPicker
ColorSheet().colorPicker(
colors = colors,
selectedColor = color,
listener = { color ->
// Handle color
})
.show(supportFragmentManager)
Misc
Corner radius
Default corner radius is 4dp. You can set your own corner radius like this
ColorSheet().cornerRadius(8)
Color to Hex string
ColorSheetUtils.colorToHex(color)
Sheet title textAppearance
<style name="AppTheme" parent="Theme.MaterialComponents">
<item name="colorSheetTitleFont">@font/font</item>
<item name="colorSheetTitleLineHeightHint">@dimen/line_height_hint</item> // in sp
<item name="colorSheetTitleLetterSpacing">0</item>
</style>