Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@patrtorg/consequatur-distinctio
Advanced tools
@patrtorg/consequatur-distinctio is a fast and lightweight javascript library for generating unique and beautiful colors from any texts or numbers.
npm
or yarn
$ npm install @patrtorg/consequatur-distinctio
# or
$ yarn add @patrtorg/consequatur-distinctio
ES6 Import:
import @patrtorg/consequatur-distinctio from '@patrtorg/consequatur-distinctio';
CommonJS (like nodejs, webpack, and browserify):
const @patrtorg/consequatur-distinctio = require('@patrtorg/consequatur-distinctio');
AMD (like RequireJS):
define(['@patrtorg/consequatur-distinctio'], function (@patrtorg/consequatur-distinctio) {
// ...
})
<script>
Include @patrtorg/consequatur-distinctio.js
or @patrtorg/consequatur-distinctio.min.js
into your html file:
<script src="https://unpkg.com/@patrtorg/consequatur-distinctio/dist/@patrtorg/consequatur-distinctio.min.js" type="text/javascript"></script>
<script type="text/javascript">
var color = @patrtorg/consequatur-distinctio('Hello world!');
</script>
/* Generate unique color from texts or numbers */
@patrtorg/consequatur-distinctio('Hello world!')
// { color: "#5cc653", isLight: true }
@patrtorg/consequatur-distinctio('bf545d4c-5360-4158-a572-bd3e204185a9', { format: 'rgb' })
// { color: "rgb(128, 191, 64)", isLight: true }
@patrtorg/consequatur-distinctio(123, {
saturation: [35, 70],
lightness: 25,
})
// { color: "#405926", isLight: false }
@patrtorg/consequatur-distinctio(123, {
saturation: [35, 70],
lightness: 25,
differencePoint: 50,
})
// { color: "#405926", isLight: true }
// Generate random color
@patrtorg/consequatur-distinctio.random()
// { color: "#644cc8", isLight: false }
// Generate a random color with HSL format
@patrtorg/consequatur-distinctio.random({ format: 'hsl' })
// { color: "hsl(89, 55%, 60%)", isLight: true }
// Generate a random color in specific saturation and lightness
@patrtorg/consequatur-distinctio.random({
saturation: 80,
lightness: [70, 80],
})
// { color: "#c7b9da", isLight: true }
// Generate a random color but exclude red color range
@patrtorg/consequatur-distinctio.random({
excludeHue: [[0, 20], [325, 359]],
})
// {color: '#53caab', isLight: true}
Object
Generate unique color from value
Params:
value
(type: string|number
)options
(type: Object
, default: {}
)options.format
(type: string
, default: 'hex'
): The color format, it can be one of hex
, rgb
or hsl
options.saturation
(type: number|Array
, default: [50, 55]
): Determines the color saturation, it can be a number or a range between 0 and 100options.lightness
(type: number|Array
, default: [50, 60]
): Determines the color lightness, it can be a number or a range between 0 and 100options.differencePoint
(type: number
, defualt: 130
): Determines the color brightness difference point. We use it to obtain the isLight
value in the output, it can be a number between 0 and 255Output:
color
(type: string
): The generated colorisLight
(type: boolean
): Determines whether the color
is a light color or a dark color (It's good for choosing a foreground color, like font color)Object
Generate random color
Params:
options
(type: Object
, default: {}
)options.format
(type: string
, default: 'hex'
): The color format, it can be one of hex
, rgb
or hsl
options.saturation
(type: number|Array
, default: [50, 55]
): Determines the color saturation, it can be a number or a range between 0 and 100options.lightness
(type: number|Array
, default: [50, 60]
): Determines the color lightness, it can be a number or a range between 0 and 100options.differencePoint
(type: number
, default: 130
): Determines the color brightness difference point. We use it to obtain the isLight
value in the output, it can be a number between 0 and 255options.excludeHue
(type: Array
): Exclude certain hue ranges. For example to exclude red color range: [[0, 20], [325, 359]]
.Your ideas and contributions are welcome; check out our contributing guide
The unicorn shape in the logo made by Freepik is licensed by CC 3.0 BY
MIT © 2017 Rasool Dastoori
FAQs
Unknown package
The npm package @patrtorg/consequatur-distinctio receives a total of 68 weekly downloads. As such, @patrtorg/consequatur-distinctio popularity was classified as not popular.
We found that @patrtorg/consequatur-distinctio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.