All Projects → JonnyBurger → use-color-change

JonnyBurger / use-color-change

Licence: other
📈📉React hook for flashing a text when a value becomes higher or lower

Programming Languages

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

Projects that are alternatives of or similar to use-color-change

LycricsTextView
No description or website provided.
Stars: ✭ 14 (-56.25%)
Mutual labels:  color, change
ColorRatingBar
change color of star in rating bar
Stars: ✭ 23 (-28.12%)
Mutual labels:  color, change
hcv-color
🌈 Color model HCV/HCG is an alternative to HSV and HSL, derived by Munsell color system, usable for Dark and Light themes... 🌈
Stars: ✭ 44 (+37.5%)
Mutual labels:  color, value
sudohulk
try privilege escalation changing sudo command
Stars: ✭ 114 (+256.25%)
Mutual labels:  hook, change
Virtual Controllers
Virtual controls for use in Flash based games on touch devices. Includes thumbstick and button ui elements
Stars: ✭ 16 (-50%)
Mutual labels:  flash
Interface-Inspector-Hook
Interface Inspector破解
Stars: ✭ 43 (+34.38%)
Mutual labels:  hook
Coulr
Color box to help developers and designers
Stars: ✭ 25 (-21.87%)
Mutual labels:  color
Ryder
Runtime redirection of method calls for .NET Core.
Stars: ✭ 34 (+6.25%)
Mutual labels:  hook
sh
Collection Of My Sh Scripts.
Stars: ✭ 109 (+240.63%)
Mutual labels:  color
UIImageColorRatio
A tool to calculate the color ratio of UIImage in iOS.
Stars: ✭ 34 (+6.25%)
Mutual labels:  color
khroma
A collection of functions for manipulating CSS colors, inspired by SASS.
Stars: ✭ 28 (-12.5%)
Mutual labels:  color
rdeco
响应式对象编程库,从时间和空间上解耦你的代码
Stars: ✭ 54 (+68.75%)
Mutual labels:  hook
Dictionary
A dictionary data type with a fast b-tree based search
Stars: ✭ 39 (+21.88%)
Mutual labels:  value
toolchain
A cmake based toolchain with support for diffrent micrcocontrollers.
Stars: ✭ 16 (-50%)
Mutual labels:  flash
ColorClockSaver
A screensaver for macOS
Stars: ✭ 57 (+78.13%)
Mutual labels:  color
colorize
*nixy filter that adds color to its standard input by rows or columns
Stars: ✭ 83 (+159.38%)
Mutual labels:  color
terbilang
Sebuah pustaka untuk menterjemahkan angka ke dalam bilangan Bahasa Indonesia
Stars: ✭ 46 (+43.75%)
Mutual labels:  numeric
libmem
Advanced Game Hacking Library for C/C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External)
Stars: ✭ 336 (+950%)
Mutual labels:  hook
has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (-15.62%)
Mutual labels:  value
CDDN-Change-DNS-Dynamically-with-your-Network
This script allows you to have the best configuration of your DNS when switching from one Wi-Fi to another.
Stars: ✭ 22 (-31.25%)
Mutual labels:  change

use-color-change

React hook for flashing a numeric value when it changes

Installation

This module can be used in any React project that supports hooks.

npm i use-color-change

Usage

Use the hook and pass a number as the first parameter. Specify the colors you want to flash and how long the animation should take. The return value of the hook has the type {animation: string}, you can pass it as a style for any element and also further customize it for example using animation-timing-function if you please.

export const App = () => {
    const [value, setValue] = useState(0);
    const colorStyle = useColorChange(value, {
        higher: 'limegreen',
        lower: 'crimson',
        duration: 1800
    });

    return <div style={colorStyle}>{value}</div>;
};

Function signature

useColorChange(value: number, {
    higher: string | null;
    lower: string | null;
    duration?: number | undefined;
})
  • value: The numeric value for which the animation should be based on.
  • options:
    • higher: The color which should be flashing when the value increases. You can pass null for no animation.
    • lower: The color which should be flashing when the value decreases. You can pass null for no animation.
    • duration: (optional) How long the flash should take in miliseconds. Default is 1800.
    • property: (optional) either color or background-color, allowing you to animate the background color instead.

Author

© Jonny Burger

License

MIT

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