All Projects → yuki-koyama → Tinycolormap

yuki-koyama / Tinycolormap

Licence: mit
A header-only, single-file library for colormaps written in C++11

Projects that are alternatives of or similar to Tinycolormap

Complete Google Map Api Tutorial
Learn How to use Google Map API for Android from Basic to Advance with complete examples.
Stars: ✭ 104 (-12.61%)
Mutual labels:  map
Ls colors
A collection of LS_COLORS definitions; needs your contribution!
Stars: ✭ 1,568 (+1217.65%)
Mutual labels:  color
Dainty Vs
Dainty for Visual Studio – A color theme generator using Lab color space
Stars: ✭ 115 (-3.36%)
Mutual labels:  color
Colorwanted
Screen color picker for Windows (Windows 上的屏幕取色器)
Stars: ✭ 105 (-11.76%)
Mutual labels:  color
Monolog Colored Line Formatter
Colored/ANSI Line Formatter for Monolog
Stars: ✭ 108 (-9.24%)
Mutual labels:  color
Magit Delta
Use delta (https://github.com/dandavison/delta) when viewing diffs in Magit
Stars: ✭ 109 (-8.4%)
Mutual labels:  color
String To Color
Time invariant color from any object.
Stars: ✭ 101 (-15.13%)
Mutual labels:  color
Box Cli Maker
Make Highly Customized Boxes for your CLI
Stars: ✭ 115 (-3.36%)
Mutual labels:  color
Chalk Animation
🎬 Colorful animations in terminal output
Stars: ✭ 1,489 (+1151.26%)
Mutual labels:  color
Geo Data Viewer
🗺️ Geo Data Viewer w/0 Py 🐍 || pyWidgets ⚙️ || pandas 🐼 || @reactjs ⚛️ required to gen. some snazzy maps 🗺️ with keplerGL ...
Stars: ✭ 115 (-3.36%)
Mutual labels:  map
Gods
GoDS (Go Data Structures). Containers (Sets, Lists, Stacks, Maps, Trees), Sets (HashSet, TreeSet, LinkedHashSet), Lists (ArrayList, SinglyLinkedList, DoublyLinkedList), Stacks (LinkedListStack, ArrayStack), Maps (HashMap, TreeMap, HashBidiMap, TreeBidiMap, LinkedHashMap), Trees (RedBlackTree, AVLTree, BTree, BinaryHeap), Comparators, Iterators, …
Stars: ✭ 10,883 (+9045.38%)
Mutual labels:  map
Smartmaterialspinner
The powerful android spinner library for your application
Stars: ✭ 108 (-9.24%)
Mutual labels:  color
Cyclosm Cartocss Style
Cycle oriented CartoCSS style.
Stars: ✭ 109 (-8.4%)
Mutual labels:  map
Iceberg.vim
🇦🇶 Bluish color scheme for Vim and Neovim
Stars: ✭ 1,636 (+1274.79%)
Mutual labels:  color
Colors.jl
Color manipulation utilities for Julia
Stars: ✭ 114 (-4.2%)
Mutual labels:  color
Wb srgb
White balance camera-rendered sRGB images (CVPR 2019) [Matlab & Python]
Stars: ✭ 101 (-15.13%)
Mutual labels:  color
Terrain Classic
World-wide CartoCSS port of Stamen's classic terrain style
Stars: ✭ 110 (-7.56%)
Mutual labels:  map
Geojson2svg
Converts geojson to svg string given svg viewport size and maps extent.
Stars: ✭ 117 (-1.68%)
Mutual labels:  map
Zoya
Truly highly composable logging utility
Stars: ✭ 116 (-2.52%)
Mutual labels:  color
Console Logging
Better, prettier commandline logging for Python--with colors! 👻
Stars: ✭ 111 (-6.72%)
Mutual labels:  color

tinycolormap

macOS Ubuntu GitHub

A header-only, single-file library for colormaps written in C++11.

Available Colormaps

Matlab

Name Sample
Parula
Heat
Hot
Jet
Gray

Reference: https://www.mathworks.com/help/matlab/ref/colormap.html

Matplotlib

Name Sample
Magma
Inferno
Plasma
Viridis
Cividis

These colormaps are designed to be perceptually uniform (even in black-and-white printing) and friendly to colorblindness. Cividis is specially designed such that it enables as identical interpretation to both those without a CVD and those with red-green colorblindness as possible.

Magma, Inferno, Plasma, Viridis are released under CC0 by Nathaniel J. Smith, Stefan van der Walt, and (in the case of Viridis) Eric Firing: https://github.com/BIDS/colormap/blob/master/colormaps.py. Their python code is adapted for the use in C++11.

Cividis is released under CC0 by the authors of PLOS ONE paper (Jamie R. Nuñez, Christopher R. Anderton, Ryan S. Renslow): https://doi.org/10.1371/journal.pone.0199239. We incorporated the LUT into C++11.

GitHub

Name Sample
Github

This colormap is designed to mimic the color scheme used in GitHub contributions visualization.

Other

Name Sample
Turbo

Turbo is developed as an alternative to the Jet colormap by Anton Mikhailov (Google LLC). See the blog post for the details. The original lookup table is released under the Apache 2.0 license. We merged it and re-licensed the part under the MIT license for consistency.

Dependency

tinycolormap does not have any dependencies except for C++11 standard library.

Installation

tinycolormap is a header-only library, so you do not need to compile it. You can use it by

  • Adding the path to the include directory in the cloned tinycolormap repository to your project's include paths, or
  • Copying the file tinycolormap.hpp to your project (note that tinycolormap consists of only that single file).

If your project is managed by Cmake https://cmake.org/, add_subdirectory or ExternalProject_Add commands are useful as tinycolormap provides CMakeLists.txt for this purpose.

Usage

The core function of this library is

inline Color GetColor(double x, ColormapType type);

where x should be between 0.0 and 1.0 (otherwise, it will be cropped), and type is the target colormap type like Viridis (default) and Heat.

Here is a working code:

#include <iostream>
#include <tinycolormap.hpp>

int main()
{
  // Define a target value. This value should be in [0, 1]; otherwise, it will be cropped to 0 or 1.
  const double value = 0.5;

  // Get the mapped color. Here, Viridis is specified as the colormap.
  const tinycolormap::Color color = tinycolormap::GetColor(value, tinycolormap::ColormapType::Viridis);

  // Print the RGB values. Each value is in [0, 1].
  std::cout << "r = " << color.r() << ", g = " << color.g() << ", b = " << color.b() << std::endl;

  return 0;
}

Options for External Libraries Integration

Qt5 Support

When TINYCOLORMAP_WITH_QT5 is defined before including tinycolormap.hpp, for example,

#define TINYCOLORMAP_WITH_QT5
#include <tinycolormap.hpp>

(or TINYCOLORMAP_WITH_QT5 CMake option is ON), this library offers an additional utility function:

const QColor color = tinycolormap::GetColor(x).ConvertToQColor();

Eigen Support

When TINYCOLORMAP_WITH_EIGEN is defined before including tinycolormap.hpp, for example,

#define TINYCOLORMAP_WITH_EIGEN
#include <tinycolormap.hpp>

(or TINYCOLORMAP_WITH_EIGEN CMake option is ON), this library offers an additional utility function:

const Eigen::Vector3d color = tinycolormap::GetColor(x).ConvertToEigen();

Qt5 and Eigen Support

When both Qt5 and Eigen are available, this library offers additional utility functions:

inline QImage CreateMatrixVisualization(const Eigen::MatrixXd& matrix);
inline void ExportMatrixVisualization(const Eigen::MatrixXd& matrix, const std::string& path);

GLM Support

When TINYCOLORMAP_WITH_GLM is defined before including tinycolormap.hpp, for example,

#define TINYCOLORMAP_WITH_GLM
#include <tinycolormap.hpp>

(or TINYCOLORMAP_WITH_GLM CMake option is ON), this library offers an additional utility function:

const glm::vec3 color = tinycolormap::GetColor(x).ConvertToGLM();

Tools (Optional)

This repository includes the following optional tools:

  • PNG Exporter: This tool exports all the available colormaps as PNG images.

Tools Build Instruction

The optional tools are managed by CMake https://cmake.org/. They can be built by, for example,

mkdir build
cd build
cmake [PATH_TO_TINYCOLORMAP] -DTINYCOLORMAP_BUILD_TOOLS=ON
make

Projects using tinycolormap

License

The MIT License (except for tools/png-exporter/stb_image_write.h, which is released under public domain).

Contribute

Pull requests are welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].