Giter Site home page Giter Site logo

rcsb / colorbrewer Goto Github PK

View Code? Open in Web Editor NEW
37.0 8.0 12.0 1016 KB

:rainbow: Create color blind friendly color palettes in Java

License: GNU Lesser General Public License v2.1

Java 100.00%
colorbrewer color-palette java colorblind colorpicker

colorbrewer's Introduction

Colorbrewer

Build Status Version License

Create color blind friendly color palettes in Java.

Note

Note that this repository has been archived because it is not actively maintained anymore.

The color palettes provided by this library are based on the colors provided by the color brewer project,

In principle there are three types of palettes provided:

  • Sequential example

  • Diverging example

  • Qualitative example

For each palette any number of steps (=colors) in the palette can be requested.

How to Use

Show a user Dialog

	final ColorPaletteChooserDialog dialog = new ColorPaletteChooserDialog();
	dialog.show();
	if(dialog.wasOKPressed()) {
		Color c = dialog.getColor();
	}

will display this dialog:

Screenshot of a ColorPaletteChooserDIalog

Create a palette programmatically

Get a color palette with a specific number of color:

	boolean colorBlindSave = true;
		ColorBrewer[] sequentialPalettes = ColorBrewer.getSequentialColorPalettes(colorBlindSave);	


		ColorBrewer myBrewer = sequentialPalettes[0];

		System.out.println( "Name of this color brewer: " + myBrewer);

		// I want a gradient of 8 colors:
		Color[] myGradient = myBrewer.getColorPalette(8);

		// These are the color codes:
		for (Color color: myGradient){
			// convert to hex for web display:
			String hex = Integer.toHexString(color.getRGB() & 0xffffff);			
			System.out.println("#"+hex+";");
		}
		
		return myGradient;
	
	

This provides the following 8 blue colors: The 'Blues' color palette

Installation

This project is now hosted on Maven Central. You can install the jar file by adding this to your project configuration:

<dependencies>
 <dependency>
  <groupId>org.biojava</groupId>
  <artifactId>jcolorbrewer</artifactId>
  <version>5.2</version>
 </dependency>
</dependencies>

Example Application

Here we are coloring the various components of the virus structure of the human poliovirus ( PDB ID 3J69 ) .

PDB ID 3J69

Acknowledgments

Colors from www.ColorBrewer.org by Cynthia A. Brewer, Geography, Pennsylvania State University.

colorbrewer's People

Contributors

andreasprlic avatar josemduarte avatar pwrose avatar raffaelwagner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.