import numpy as np
import pandas as pd
import seaborn as sns
%load_ext autoreload
%load_ext watermark
%autoreload 2
%watermark -a "Bhishan Poudel" -d -v -m
%watermark -iv
Bhishan Poudel 2021-07-11 CPython 3.7.7 IPython 7.22.0 compiler : Clang 4.0.1 (tags/RELEASE_401/final) system : Darwin release : 19.6.0 machine : x86_64 processor : i386 CPU cores : 4 interpreter: 64bit pandas 1.2.4 numpy 1.19.5 seaborn 0.11.0
# my local library
import sys
sys.path.append("/Users/poudel/Dropbox/a00_Bhishan_Modules/")
sys.path.append("/Users/poudel/Dropbox/a00_Bhishan_Modules/bhishan")
from bhishan import bp
from bhishan import randomcolor
This projects is adapted from https://github.com/kevinwuhoo/randomcolor-py
You can pass an options object to influence the type of color it produces. The options object accepts the following properties:
Hue – Controls the hue of the generated color. You can pass a string representing a color name: red
, green
, blue
, orange
, yellow
, purple
, pink
and monochrome
are currently supported. RGB MYPPO
Luminosity – Controls the luminosity of the generated color. You can specify a string containing bright
, light
or dark
.
Count – An integer which specifies the number of colors to generate.
Seed - An integer or string which when passed will cause randomColor to return the same color each time.
Format – A string which specifies the format of the generated color. Possible values are rgb
, rgbArray
, hsl
, hslArray
and hex
(default).
rand_color = randomcolor.RandomColor(42)
from bhishan.randomcolor import RandomColor as RC
RC(42).generate('red', count=3)
['#e5a997', '#e87183', '#fca9c2']
rand_color.generate()
['#e094be']
rand_color.generate(hue="blue", count=3)
['#628fc9', '#92c8db', '#37217f']
rand_color.generate("blue", 3) # ONLY gives one color
['#a0e5e8']
rand_color.generate(luminosity='bright', count=3)
['#21ea1e', '#aa3211', '#e5026c']
rand_color.generate(hue='orange', luminosity='dark',count=3)
['#d6790e', '#b2720a', '#d39c10']
rand_color.generate(hue='monochrome', format_='rgb')
['rgb(89, 89, 89)']