Giter Site home page Giter Site logo

trendingtechnology / andcolorpicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from side-codes/android-color-picker

0.0 2.0 0.0 873 KB

๐Ÿฅ‘ Handy, ๐Ÿ flexible and โšก๏ธ lightning-fast material android color picker view components

License: Apache License 2.0

Kotlin 100.00%

andcolorpicker's Introduction

๐Ÿฅ‘ Handy, ๐Ÿ flexible and โšก lightning-fast material color picker view components for Android

๐Ÿ’ฌ Work-In-Progress

๐Ÿ’Š Features

  • Clean, easy-to-use components and API
  • High performance
  • Material styling in mind
  • Standard Android SDK view family
  • Wide color models support
  • Tooling and utilities
  • Alpha channel support
  • Cutting edge tech stack
  • Active development and support

๐Ÿ”จ Setup

Gradle dependency:

implementation "codes.side:andcolorpicker:0.3.0"

๐ŸŽจ Picker types

HSL (hue, saturation, lightness)

  • Add color model description

Layout XML Snippet

Basic HSL components:

<codes.side.andcolorpicker.hsl.HSLColorPickerSeekBar
  android:id="@+id/hueColorPickerSeekBar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  app:hslColoringMode="pure"
  app:hslMode="hue" />

Supported hslMode values:

  • hue (default)
  • saturation
  • lightness

Supported hslColoringMode values:

  • pure (default)
  • output

Alpha component:

<codes.side.andcolorpicker.alpha.HSLAlphaColorPickerSeekBar
  android:id="@+id/alphaColorPickerSeekBar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" />

Kotlin Snippet

// Configure picker color model programmatically
hueColorPickerSeekBar.mode = Mode.MODE_HUE // Mode.MODE_SATURATION, Mode.MODE_LIGHTNESS

// Configure coloring mode programmatically
hueColorPickerSeekBar.coloringMode = ColoringMode.PURE_COLOR // ColoringMode.OUTPUT_COLOR

// Group pickers with PickerGroup to automatically synchronize color across them
val pickerGroup = PickerGroup<IntegerHSLColor>().also {
  it.registerPickers(
    hueColorPickerSeekBar,
    saturationColorPickerSeekBar,
    lightnessColorPickerSeekBar,
    alphaColorPickerSeekBar
  )
}

// Get current color immediately
Log.d(
  TAG,
  "Current color is ${hueColorPickerSeekBar.pickedColor}"
)

// Listen individual pickers or groups for changes
pickerGroup.addListener(
  object : HSLColorPickerSeekBar.DefaultOnColorPickListener() {
    override fun onColorChanged(
      picker: ColorSeekBar<IntegerHSLColor>,
      color: IntegerHSLColor,
      value: Int
    ) {
      Log.d(
        TAG,
        "$color picked"
      )
      swatchView.setSwatchColor(
        color
      )
    }
  }
)

// Set desired color programmatically
pickerGroup.setColor(
  IntegerHSLColor().also {
    it.setFromColorInt(
      Color.rgb(
        28,
        84,
        187
      )
    )
  }
)

// Set color components programmatically
hueColorPickerSeekBar.progress = 50

RGB (red, green, blue)

Layout XML Snippet

Basic RGB components:

<codes.side.andcolorpicker.rgb.RGBColorPickerSeekBar
  android:id="@+id/redRGBColorPickerSeekBar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  app:rgbMode="red" />

LAB

Layout XML Snippet

Basic LAB components:

<codes.side.andcolorpicker.lab.LABColorPickerSeekBar
  android:id="@+id/lLABColorPickerSeekBar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  app:labMode="l" />

CMYK (cyan, magenta, yellow, key)

Layout XML Snippet

Basic CMYK components:

<codes.side.andcolorpicker.cmyk.CMYKColorPickerSeekBar
  android:id="@+id/cyanCMYKColorPickerSeekBar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  app:cmykMode="cyan" />

Supported cmykMode values:

  • cyan (default)
  • magenta
  • yellow
  • black

Supported cmykColoringMode values:

  • pure (default)
  • output

Swatches

SwatchView component:

<codes.side.andcolorpicker.view.swatch.SwatchView
  android:id="@+id/swatchView"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" />

Kotlin Snippet:

swatchView.setSwatchPatternTint(
  Color.LTGRAY
)

swatchView.setSwatchColor(
  IntegerHSLColor().also {
    it.setFromColorInt(
      ColorUtils.setAlphaComponent(
        Color.MAGENTA,
        128
      )
    )
  }
)

๐Ÿš€ Roadmap

  • Add more picker types
    • HLS SeekBars
    • RGB SeekBars
    • RGB circle
    • RGB plane
    • HSV/HSB seekbars
    • CMYK SeekBars
    • Alpha SeekBars
    • HSL (S+L) plane
    • LAB
    • XYZ
    • YPbPr
    • Swatches
  • Extend picker types
    • CMYK SeekBars coloring modes
    • More awesome swatches
    • More supported alpha color models
  • Sample buttons -> radios
  • Remove sample app child press delays
  • Enhance API
  • Add XML attributes
  • Provide git-flow
  • Automate release/publish flow
  • Add thumb animation
  • Add MaterialDrawer & sample fragments
  • Add more HSLColorPickerSeekBar checks and reduce calls count
  • Add more encapsulation to limit picker modification capabilities
  • Package repository publish (Bintray)
  • Add Rx support
  • Add/Revisit RecyclerView support
  • Add sample app icon
  • Add logger solution
  • Add sample app analytics
  • Add GIFs media
  • Add call flow diagram
  • Add tests
  • Add docs
  • Add contribution guidelines
  • Add OSS licenses
  • Add license

๐Ÿ“ License

Copyright 2020 Illia Achour

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

andcolorpicker's People

Contributors

bayramcicek avatar dependabot-preview[bot] avatar n7k avatar smelfungus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.