All Projects → lffg-labs → yiq

lffg-labs / yiq

Licence: MIT license
Returns white when a color is dark and black when a color is light.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to yiq

stellarized
✦ paint vim with the stars ✦
Stars: ✭ 70 (+191.67%)
Mutual labels:  light, color, dark
thewhite
✒️ It's a minimal and light wordpress blog theme 🎨
Stars: ✭ 87 (+262.5%)
Mutual labels:  light, white
minimal-theme
Minimal theme for Emacs 24
Stars: ✭ 75 (+212.5%)
Mutual labels:  light, dark
github-theme-for-jetbrains
GitHub Theme for Jetbrains is heavily inspired by GitHub 3 Color Scheme and github-vscode-theme.The focus of the development of this theme plugin is to restore the official GitHub theme as much as possible, keeping the colors easy to distinguish, proper contrast, and pleasant.
Stars: ✭ 20 (-16.67%)
Mutual labels:  light, dark
vscode-theme-gruvbox-minor
Gruvbox theme for Visual Studio Code
Stars: ✭ 17 (-29.17%)
Mutual labels:  light, dark
hexagonTab
Hexagon bookmarks accented with a chosen colour. Customise the layout, style, background and bookmarks with hexagonTab.
Stars: ✭ 65 (+170.83%)
Mutual labels:  light, dark
InplaceEditBoxLib
WPF/MVVM control to implement a textbox on top of other elements like TreeViewItem or ListViewItem (use case: perform in place edit on top of a displayed text item)
Stars: ✭ 28 (+16.67%)
Mutual labels:  light, dark
Perfect Dark Mode
🌚🌝 Perfect Dark Mode
Stars: ✭ 70 (+191.67%)
Mutual labels:  color, dark
Nighttab
A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.
Stars: ✭ 598 (+2391.67%)
Mutual labels:  light, dark
Github Vscode Theme
GitHub's VS Code theme
Stars: ✭ 1,089 (+4437.5%)
Mutual labels:  light, dark
Discord Plus
A sleek, customizable Discord theme.
Stars: ✭ 65 (+170.83%)
Mutual labels:  light, dark
Typora Misty Theme
Yet another elegant Typora theme designed with aesthetics in mind.
Stars: ✭ 179 (+645.83%)
Mutual labels:  light, dark
ColorPickerLib
A WPF/MVVM implementation of a themeable color picker control.
Stars: ✭ 44 (+83.33%)
Mutual labels:  light, color
Iceberg.vim
🇦🇶 Bluish color scheme for Vim and Neovim
Stars: ✭ 1,636 (+6716.67%)
Mutual labels:  color, dark
Spectral Clara Lux Tracer
A physically based ray tracer with multiple shading models support and Color Rendering Index (CRI) evaluation. Project developed for my master degree thesis at University Milano-Bicocca.
Stars: ✭ 91 (+279.17%)
Mutual labels:  light, color
vim-humanoid-colorscheme
Light and dark theme for vim with bright colors
Stars: ✭ 67 (+179.17%)
Mutual labels:  light, dark
Leonardo
Generate colors based on a desired contrast ratio
Stars: ✭ 973 (+3954.17%)
Mutual labels:  color, dark
Bootstrap Dark
The Definitive Guide to Dark Mode and Bootstrap 4 - A proof of concept
Stars: ✭ 54 (+125%)
Mutual labels:  color, dark
Redis Ui
📡 P3X Redis UI is a very functional handy database GUI and works in your pocket on the responsive web or as a desktop app
Stars: ✭ 334 (+1291.67%)
Mutual labels:  light, dark
Eziam Theme Emacs
A mostly grayscale theme for Emacs, inspired by Tao and Leuven.
Stars: ✭ 74 (+208.33%)
Mutual labels:  light, dark

YIQ

Returns light when a color is dark and dark when a color is light. 🎨

CI NPM Uses TypeScript

Installing

yarn add yiq

# If you're using NPM:
# npm install yiq --save

Basic Usage

Just call the yiq function after importing it:

import { yiq } from 'yiq';

console.log(yiq('#fff')); // #000
console.log(yiq('#000')); // #fff

API

yiq

yiq — Returns a light color when a color is dark and a dark color when a color is light.

Description

function yiq(
  colorHex: string,
  options?: {
    colors?: {
      light: string;
      dark: string;
    };
    threshold?: number;
  }
): string;

The second argument (options) can be used to define the colors that the function will return:

yiq('#fff', {
  colors: {
    light: '#f0f0f0',
    dark: '#333'
  }
}); // #333

It can also be used to define the threshold YIQ value at which the function switches between light and dark:

yiq('#36d386', { threshold: 156 }); // #fff

The default options are:

  • options.colors.light: #fff;
  • options.colors.dark: #000;
  • options.threshold: 128.

Authors and License

lffg and contributors.

MIT License, see the included MIT file.

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