iTunes 11-style color matching code for Android

Related tags

Utility ColorArt
Overview

##About

ColorArt is a library that uses an image to create a themed image/text display. It's a port of the idea found on the Panic Blog to work on Android.

##Usage

(ColorArt is supported on Android 2.1+.)

Add ColorArt as a dependency to your build.gradle file:

compile 'org.michaelevans.colorart:library:0.0.3'

Then you can use the library like this:

// get a bitmap and analyze it
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.album);
ColorArt colorArt = new ColorArt(bitmap);

// get the colors
colorArt.getBackgroundColor()
colorArt.getPrimaryColor()
colorArt.getSecondaryColor()
colorArt.getDetailColor()

###FadingImageView

mFadingImageView.setBackgroundColor(colorArt.getBackgroundColor(), FadingImageView.FadeSide.LEFT);

This will set the fading edge on the left side, with that background color. You can also enable/disable the fade with:

mImageView.setFadeEnabled(true/false);

##Screenshots

Jim Noir Ping Pong Orchestra Hotel Shampoo

##License

Copyright 2015 Michael Evans

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.

Bitdeli Badge

Comments
  • Updated build scripts for gradle build tools 1.0.0.

    Updated build scripts for gradle build tools 1.0.0.

    In trying to address issue #17, I've updated the build scripts to work with the newer version of gradle build tools. This may or may not fix the issue, as I didn't push the build out to a repository and see if I could pull it fine as a dependency.

    opened by dhesson 2
  • Support SDK Version >=7, and assorted cleanups

    Support SDK Version >=7, and assorted cleanups

    Hi Michael,

    I'm particularly interested in seeing the minSdKVersion change go in, since I have an app (https://github.com/nikclayton/android-squeezer) that supports SDK 7 and up and I'd like to use the ColorArt library with it. As far as I can tell there's nothing in ColorArt that uses any higher SDK features, so this should be safe.

    The other changes are just straightforward cleanups.

    Thanks, Nik

    opened by nikclayton 1
  • NullPointerException in findTextColors()

    NullPointerException in findTextColors()

    I could trigger an NPE in findTextColors(), line 164

    
                } else if (mSecondaryColor == null) {
    NPE HERE  =>   if (!isDistinctColor(mPrimaryColor, currentColor) ||        
                            !isContrastingColor(currentColor, mBackgroundColor)) {
                        continue;
    
    

    mPrimaryColor can be null, hence the NPE since isDistinctColor() expects an int as first parameter.

    opened by bubbleguuum 1
  • add spaces between ### and titles

    add spaces between ### and titles

    .. If you do so, your markdown starts to show up properly) Cooooooool library! =)

    Also, I'm interested, do you use some kind of random heuristics points or just scan the whole bitmap to calculate most dominant colors? (so that the algorithm complexity is O(n^2) ?)

    opened by intmainreturn00 0
  • remove android:allowBackup

    remove android:allowBackup

    Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:28:9-36 is also present at [org.michaelevans.colorart:library:0.0.3] AndroidManifest.xml:12:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:23:5-58:19 to override.

    opened by siddharth-mody 0
  • Having problems getting correct colors.

    Having problems getting correct colors.

    It seems that the algorithm you're using has a tough time picking out reds. I'm using your library to pick out colors for albums and here is the first example of something going not as expected.

    A Star Is Born

    The background color is pretty good. It could be a little darker to reflect that the album background isn't pure white. My main issue is with the primary color here. There are pretty much only two colors on the album, white and red. The red doesn't show up in any of the colors, be it primary, secondary, or detail color. In all of these examples, the colors are as follows:

    • Background color is from ColorArt.getBackgroundColor()
    • Song title is ColorArt.getPrimaryColor()
    • Artist is ColorArt.getSecondaryColor()
    • The time played and time left textviews are ColorArt.getPrimaryColor()
    • The progress bar on the seekbar is ColorArt.getSecondaryColor()
    • The draggable thumb on the seekbar is ColorArt.getPrimaryColor()

    Here's another example

    11:11pm

    The background color is a dark brown/green. Ideally it would be a red or a white as those are the two most dominant colors in the image and they also touch the borders.

    Yet another example:

    9MM

    For this album cover, the background color is good. What's weird is that the primary color is pink. There isn't really pink on the album cover, though there is a bit of red in the reflection of the sunglasses. It would make more sense for the primary color to be a black, white or brown.

    Moar example:

    Say Something

    There should be red/magenta as the primary color.

    Last example:

    Witness

    Nix the purple/lilac. Use the reds/oranges/light blues/blacks or whites. The background color should definitely be white here as that is also the background color of the album. Red or orange would work as well.

    EDIT:

    I found some more weird occurrences. In the following image, there shouldn't be any light blue.

    More to Life

    In the following image, there should not be pink.

    Yiruma

    In the future, similar to Chris Banes's ColorFinder, it would be nice to have a secondary text color which is either black or white depending on the brightness of the background color to ensure high visibility/readability.

    opened by AOrobator 0
  • Crashes when working with images that has transparent pixels

    Crashes when working with images that has transparent pixels

    java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:710) at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:447) at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:372) at java.util.ComparableTimSort.sort(ComparableTimSort.java:178) at java.util.ComparableTimSort.sort(ComparableTimSort.java:142) at java.util.Arrays.sort(Arrays.java:1973) at java.util.Collections.sort(Collections.java:1867) at org.michaelevans.colorart.library.ColorArt.findTextColors(ColorArt.java:154) at org.michaelevans.colorart.library.ColorArt.analyzeImage(ColorArt.java:49) at org.michaelevans.colorart.library.ColorArt.(ColorArt.java:44)

    opened by sweggersen 3
A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

Colours is a port of the Colours Library for iOS made by my good friend Ben Gordon. You can find that project here. Installation Maven Central Colours

Matthew York 634 Dec 28, 2022
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Jaeger 8.8k Jan 6, 2023
Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platform the code is running.

Trail Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platfor

Mauricio Togneri 13 Aug 29, 2022
recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

Sebastian Kaspari 565 Jan 2, 2023
SoLoader is a native code loader for Android.

SoLoader is a native code loader for Android. It takes care of unpacking your native libraries and recursively loads dependencies on platforms that don't support that out of the box.

Meta 1.2k Jan 3, 2023
A low intrusive, configurable android library that converts layout XML files into Java code to improve performance

qxml English 一个低侵入,可配置的 Android 库,用于将 layout xml 文件转换为 Java 代码以提高性能。 与X2C的对比 X2C: 使用注解处理器生成View类,使用时需要在类中添加注解,并替换setContentView方法,侵入性较强; 对于布局属性的支持不够完美

null 74 Oct 6, 2022
Runtime code generation for the Java virtual machine.

Byte Buddy runtime code generation for the Java virtual machine Byte Buddy is a code generation and manipulation library for creating and modifying Ja

Rafael Winterhalter 5.3k Jan 7, 2023
A small library which will save you from writing the same intent creation code again and again for the most simple tasks

Android Intents A small library which will save you from writing the same intent creation code again and again for the most simple tasks. I found myse

MarvinLabs 420 Nov 20, 2022
Polytech computer graphics couerse code scam script

Js-code-parser Polytech computer graphics couerse code scam script Копируйте строку скрипта с дебаггера с странички лабы. Вставляйте в файлик test.txt

Daniil Bakin 2 Dec 18, 2022
A Telegram bot utilities that help to reduce the code amount

Flume Party A Telegram bot utilities that help to reduce code amount. Real project examples Pull Party Bot: 19% of code has been reduced. Resistance B

pool party 1 Jun 8, 2022
Provides custom lint rules developed by Bottle Rocket Studios to help keep our code cleaner

Provides custom lint rules developed by Bottle Rocket Studios to help keep our code cleaner, detect and mitigate possible security issues, and allow us to write rules around best practices and usage as necessary in the future

Bottle Rocket Studios 1 Feb 11, 2022
λRPC allows using code with high-order functions as a service

λRPC Simple native RPC with high order functions support. Inspired by @altavir and Communicator. λRPC allows using code with high-order functions as a

Andrey Stoyan 5 May 18, 2022
Catch `dd`, `ddd`, `dump`, `sleep` and `ray` functions in your code

catch-debug-code Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get familiar with the template documentation. Verify the p

Moath Alhajri 1 Apr 29, 2022
Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.

Secure-preferences - Deprecated Please use EncryptedSharedPreferences from androidx.security in preferenced to secure-preference. (There are no active

Scott Alexander-Bown 1.5k Dec 24, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
Gesture detector framework for multitouch handling on Android, based on Android's ScaleGestureDetector

Android Gesture Detectors Framework Introduction Since I was amazed Android has a ScaleGestureDetector since API level 8 but (still) no such thing as

null 1.1k Nov 30, 2022
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

null 1.4k Jan 9, 2023
Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Shahid Iqbal 4 Nov 29, 2022
A logger with a small, extensible API which provides utility on top of Android's normal Log class.

This is a logger with a small, extensible API which provides utility on top of Android's normal Log class. I copy this class into all the little apps

Jake Wharton 9.8k Dec 30, 2022