├── settings.gradle ├── screenshots └── actionshot.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── NOTICE ├── colorpicker ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values-iw │ │ │ └── strings.xml │ │ ├── values │ │ │ └── strings.xml │ │ ├── values-es │ │ │ └── strings.xml │ │ ├── values-nl │ │ │ └── strings.xml │ │ ├── values-pl │ │ │ └── strings.xml │ │ ├── values-ru │ │ │ └── strings.xml │ │ ├── values-de │ │ │ └── strings.xml │ │ ├── values-en-rGB │ │ │ └── strings.xml │ │ ├── values-fr │ │ │ └── strings.xml │ │ ├── values-it │ │ │ └── strings.xml │ │ ├── layout │ │ │ ├── dmfs_colorpickerdialog_palette_field.xml │ │ │ ├── dmfs_colorpickerdialog_palette_grid.xml │ │ │ └── dmfs_colorpickerdialog_fragment.xml │ │ └── drawable-v21 │ │ │ └── dmfs_colorpicker_dialog_background.xml │ │ └── java │ │ └── org │ │ └── dmfs │ │ └── android │ │ └── colorpicker │ │ ├── palettes │ │ ├── CombinedColorFactory.java │ │ ├── RainbowColorFactory.java │ │ ├── ColorLightnessFactory.java │ │ ├── ColorShadeFactory.java │ │ ├── Palette.java │ │ ├── ColorFactory.java │ │ ├── RandomPalette.java │ │ ├── FactoryPalette.java │ │ └── ArrayPalette.java │ │ ├── SquareView.java │ │ ├── SquareViewPager.java │ │ ├── PaletteGridAdapter.java │ │ ├── PalettesPagerAdapter.java │ │ ├── PaletteFragment.java │ │ └── ColorPickerDialogFragment.java ├── libs │ └── drawablepagertabstrip.jar └── build.gradle ├── demo ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── values-sw600dp │ │ │ └── dimens.xml │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── palettes.xml │ │ ├── values-sw720dp-land │ │ │ └── dimens.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ └── layout │ │ │ └── activity_demo.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── org │ │ └── dmfs │ │ └── android │ │ └── colorpicker │ │ └── demo │ │ └── DemoActivity.java └── build.gradle ├── .gitignore ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':colorpicker' 2 | include ':demo' 3 | -------------------------------------------------------------------------------- /screenshots/actionshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/screenshots/actionshot.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Color Picker 2 | Copyright 2014 Marten Gajda 3 | 4 | This product includes software developed at dmfs.org -------------------------------------------------------------------------------- /colorpicker/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /colorpicker/libs/drawablepagertabstrip.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/colorpicker/libs/drawablepagertabstrip.jar -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dmfs/color-picker/HEAD/demo/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-iw/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | בחר צבע 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pick a color 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Elija un color 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Kies een kleur 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-pl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wybierz kolor 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Выберите цвет 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wähle eine Farbe 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-en-rGB/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pick a colour 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Choisir une couleur 5 | 6 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Scegli un colore 5 | 6 | -------------------------------------------------------------------------------- /demo/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jun 05 14:30:58 CEST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Colorpicker Demo 5 | Settings 6 | Pick a color … 7 | You\'ve picked: 8 | 9 | -------------------------------------------------------------------------------- /demo/src/main/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo/src/main/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/layout/dmfs_colorpickerdialog_palette_field.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # files for the dex VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # generated files 14 | bin/ 15 | gen/ 16 | apk/ 17 | 18 | # imported libraries 19 | libs/ 20 | 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | .settings 25 | 26 | # Eclipse project files 27 | .classpath 28 | .project 29 | 30 | # Android Studio 31 | .idea/ 32 | .gradle 33 | gradle 34 | /*/local.properties 35 | /*/out 36 | build 37 | /*/*/production 38 | *.iml 39 | *.iws 40 | *.ipr 41 | *~ 42 | *.swp 43 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | applicationId "org.dmfs.android.colorpicker.demo" 8 | minSdkVersion 14 9 | targetSdkVersion 28 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 16 | } 17 | } 18 | compileOptions { 19 | sourceCompatibility JavaVersion.VERSION_1_8 20 | targetCompatibility JavaVersion.VERSION_1_8 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation project(':colorpicker') 26 | implementation 'com.android.support:appcompat-v7:28.0.0' 27 | implementation 'com.github.dmfs:retention-magic:1.3' 28 | } 29 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/drawable-v21/dmfs_colorpicker_dialog_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 11 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /colorpicker/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | minSdkVersion 14 8 | targetSdkVersion 28 9 | } 10 | 11 | buildTypes { 12 | release { 13 | minifyEnabled false 14 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 15 | } 16 | } 17 | compileOptions { 18 | sourceCompatibility JavaVersion.VERSION_1_8 19 | targetCompatibility JavaVersion.VERSION_1_8 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation 'com.android.support:appcompat-v7:28.0.0' 25 | implementation 'com.android.support:support-v4:28.0.0' 26 | implementation 'com.github.dmfs.Bolts:color-bolts:0.1' 27 | implementation 'com.github.dmfs:retention-magic:1.3' 28 | implementation 'org.dmfs:jems:1.22' 29 | 30 | // TODO: replace or covert to Gradle project so we can pull it from Maven 31 | implementation files('libs/drawablepagertabstrip.jar') 32 | } 33 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/layout/dmfs_colorpickerdialog_palette_grid.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 25 | 26 | -------------------------------------------------------------------------------- /demo/src/main/res/values/palettes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Base 4 | 5 | 6 | 0xff000000 7 | 0xff000080 8 | 0xff008000 9 | 0xff800000 10 | 0xff800080 11 | 0xff808000 12 | 0xff008080 13 | 0xff808080 14 | 0xff404040 15 | 0xff0000ff 16 | 0xff00ff00 17 | 0xffff0000 18 | 0xffff00ff 19 | 0xffffff00 20 | 0xff00ffff 21 | 0xffffffff 22 | 23 | 24 | 25 | Black 26 | Dark blue 27 | Dark green 28 | Dark red 29 | Purple 30 | Dark yellow 31 | Dark cyan 32 | Dark white 33 | Grey 34 | Blue 35 | Green 36 | Red 37 | Pink 38 | Yellow 39 | Cyan 40 | White 41 | 42 | 43 | -------------------------------------------------------------------------------- /colorpicker/src/main/java/org/dmfs/android/colorpicker/palettes/CombinedColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 dmfs GmbH 3 | * 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.dmfs.android.colorpicker.palettes; 19 | 20 | /** 21 | * A Factory that combines multiple factories into one, by concatenation of the palettes. 22 | * 23 | * @author Marten Gajda 24 | */ 25 | public final class CombinedColorFactory implements ColorFactory 26 | { 27 | private final ColorFactory[] mFactories; 28 | 29 | 30 | public CombinedColorFactory(ColorFactory... factories) 31 | { 32 | mFactories = factories; 33 | } 34 | 35 | 36 | @Override 37 | public int colorAt(int index, int count) 38 | { 39 | int factoryCount = mFactories.length; 40 | return mFactories[(index * factoryCount) / count].colorAt(index % (count / factoryCount), count / factoryCount); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /colorpicker/src/main/java/org/dmfs/android/colorpicker/palettes/RainbowColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 dmfs GmbH 3 | * 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.dmfs.android.colorpicker.palettes; 19 | 20 | import android.graphics.Color; 21 | 22 | 23 | /** 24 | * A factory that returns the entire palette with a specific saturation and lightness value. 25 | * 26 | * @author Marten Gajda 27 | */ 28 | public final class RainbowColorFactory implements ColorFactory 29 | { 30 | private final float[] mHSL = new float[] { 0, 0, 0 }; 31 | 32 | 33 | public RainbowColorFactory(float saturation, float lightness) 34 | { 35 | mHSL[1] = saturation; 36 | mHSL[2] = lightness; 37 | } 38 | 39 | 40 | @Override 41 | public int colorAt(int index, int count) 42 | { 43 | count += 1; 44 | float[] hsl = mHSL; 45 | 46 | hsl[0] = index * 360f / count; 47 | 48 | return Color.HSVToColor(255, hsl); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /colorpicker/src/main/java/org/dmfs/android/colorpicker/palettes/ColorLightnessFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 dmfs GmbH 3 | * 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.dmfs.android.colorpicker.palettes; 19 | 20 | import android.graphics.Color; 21 | 22 | 23 | /** 24 | * A Factory that returns colors with a specific hue and saturation. The lightness of all colors is spread evenly across the entire palette. 25 | * 26 | * @author Marten Gajda 27 | */ 28 | public final class ColorLightnessFactory implements ColorFactory 29 | { 30 | private final float[] mHSL = new float[] { 0, 0, 0 }; 31 | 32 | 33 | public ColorLightnessFactory(float hue, float saturation) 34 | { 35 | mHSL[0] = hue; 36 | mHSL[1] = saturation; 37 | } 38 | 39 | 40 | @Override 41 | public int colorAt(int index, int count) 42 | { 43 | if (count <= 1) 44 | { 45 | return Color.WHITE; 46 | } 47 | 48 | float[] hsl = mHSL; 49 | 50 | hsl[2] = (float) index / (count - 1); 51 | 52 | return Color.HSVToColor(255, hsl); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /colorpicker/src/main/res/layout/dmfs_colorpickerdialog_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 26 | 27 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /colorpicker/src/main/java/org/dmfs/android/colorpicker/SquareView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 dmfs GmbH 3 | * 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.dmfs.android.colorpicker; 19 | 20 | import android.content.Context; 21 | import android.util.AttributeSet; 22 | import android.view.View; 23 | 24 | 25 | /** 26 | * A view that's always square. It uses the current width to set its height. 27 | * 28 | * @author Marten Gajda 29 | */ 30 | public final class SquareView extends View 31 | { 32 | public SquareView(Context context) 33 | { 34 | super(context); 35 | } 36 | 37 | 38 | public SquareView(Context context, AttributeSet attrs) 39 | { 40 | super(context, attrs); 41 | } 42 | 43 | 44 | public SquareView(Context context, AttributeSet attrs, int defStyleAttr) 45 | { 46 | super(context, attrs, defStyleAttr); 47 | } 48 | 49 | 50 | @Override 51 | protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) 52 | { 53 | final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec); 54 | setMeasuredDimension(width, width); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /colorpicker/src/main/java/org/dmfs/android/colorpicker/palettes/ColorShadeFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 dmfs GmbH 3 | * 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.dmfs.android.colorpicker.palettes; 19 | 20 | import android.graphics.Color; 21 | 22 | 23 | /** 24 | * A Factory that returns colors with a specific HUE value. This factory leaves out the edge cases - pure black and pure white. 25 | * 26 | * @author Marten Gajda 27 | */ 28 | public final class ColorShadeFactory implements ColorFactory 29 | { 30 | private final float[] mHSL = new float[] { 0, 0, 0 }; 31 | 32 | 33 | public ColorShadeFactory(float hue) 34 | { 35 | mHSL[0] = hue; 36 | } 37 | 38 | 39 | @Override 40 | public int colorAt(int index, int count) 41 | { 42 | index++; 43 | count++; 44 | float[] hsl = mHSL; 45 | 46 | if (index <= count / 2) 47 | { 48 | hsl[1] = 1f; 49 | hsl[2] = index * 2f / count; 50 | } 51 | else 52 | { 53 | hsl[1] = 2f - index * 2f / count; 54 | hsl[2] = 1f; 55 | } 56 | return Color.HSVToColor(255, hsl); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_demo.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 |