ilariaventurini / colors-convert Goto Github PK
View Code? Open in Web Editor NEW๐ฆ A simple colors library
Home Page: https://colors-convert-documentation.netlify.app/
License: MIT License
๐ฆ A simple colors library
Home Page: https://colors-convert-documentation.netlify.app/
License: MIT License
I am trying to use this in a requirement to change color name like 'red' to rgb then make a color pallette like lighter and darker, but i don't see much of examples on how to do that. API page only mentions functions, that does not even tell how to do simple import {a, b} from 'pkg'; I saw a demo folder, that does not have anything.
So i would request that we add good detailing with examples.
I have user input text box they can type in any format of color. Can we have a function called:
ConvertAnythingToColorName
Or
ConvertAnythingToStandardFormat
export { isHex, isRgb, isRgbString, isRgba, isRgbaString, isCmyk, isCmykString, isHsl, isHslString, isHsla, isHslaString, isColor, } from './lib/types/isType';
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1025:15)
at Module._compile (node:internal/modules/cjs/loader:1059:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
Hi there,
This is a cool library! Do you plan to also include support for hsla?
In the browser, due to that character, degree, the final string output is totally invalid. For now, I have used a string replace method to have it wiped out.
Thank you kindly!
Hi, I'm not being able to use colors-convert using typescript with ts-node-dev. I'm getting the following error:
yarn dev
yarn run v1.22.10
$ tsnd --respawn --transpile-only --ignore-watch node_modules src/index.ts
[INFO] 22:18:37 ts-node-dev ver. 1.1.6 (using ts-node ver. 9.1.1, typescript ver. 4.3.4)
/Users/daltonmenezes/projetos/github/new-aura/node_modules/colors-convert/dist/index.js:1
export { isHex, isRgb, isRgba, isCmyk, isHsl, isHsla, isColor } from './lib/types/isType';
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:355:18)
at wrapSafe (node:internal/modules/cjs/loader:1022:15)
at Module._compile (node:internal/modules/cjs/loader:1056:27)
at Module._compile (/Users/daltonmenezes/projetos/github/new-aura/node_modules/source-map-support/source-map-support.js:547:25)
at Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Object.nodeDevHook [as .js] (/Users/daltonmenezes/projetos/github/new-aura/node_modules/ts-node-dev/lib/hook.js:63:13)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
[ERROR] 22:18:37 SyntaxError: Unexpected token 'export'
For instance, if i already have a color of hsl type, it will be really useful to have another util method which lets me convert it to an object, as hex2hsl does for instance.
Thank you again!
react: v17.2
node: 16.13.0
react-scripts: v5+
I test with the strict minimal for render component with and without colors-convert : without it, it works
import React from 'react';
import ReactDOM from 'react-dom';
import { stringToColor } from "colors-convert";
ReactDOM.render(
<React.StrictMode>
<div className>
{(stringToColor("#000000"))}
</div>
</React.StrictMode>,
document.getElementById('root')
);
full error
<--- Last few GCs --->
[6788:0000019EF28A5DE0] 65035 ms: Scavenge 2023.7 (2077.7) -> 2021.4 (2077.7) MB, 4.9 / 0.0 ms (average mu = 0.182, current mu = 0.150) allocation failure
[6788:0000019EF28A5DE0] 65044 ms: Scavenge 2024.7 (2078.0) -> 2023.0 (2078.5) MB, 5.1 / 0.0 ms (average mu = 0.182, current mu = 0.150) allocation failure
[6788:0000019EF28A5DE0] 65058 ms: Scavenge 2025.8 (2078.5) -> 2024.0 (2087.5) MB, 7.6 / 0.0 ms (average mu = 0.182, current mu = 0.150) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF7C8EE013F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112495
2: 00007FF7C8E6F396 DSA_meth_get_flags+65526
3: 00007FF7C8E7024D node::OnFatalError+301
4: 00007FF7C97A19EE v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF7C978BECD v8::SharedArrayBuffer::Externalize+781
6: 00007FF7C962F61C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
7: 00007FF7C963C2C9 v8::internal::Heap::PublishPendingAllocations+1129
8: 00007FF7C963929A v8::internal::Heap::PageFlagsAreConsistent+2842
9: 00007FF7C962BF19 v8::internal::Heap::CollectGarbage+2137
10: 00007FF7C962A0D0 v8::internal::Heap::AllocateExternalBackingStore+2000
11: 00007FF7C964EA06 v8::internal::Factory::NewFillerObject+214
12: 00007FF7C9381CD5 v8::internal::DateCache::Weekday+1797
13: 00007FF7C982F3E1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
14: 0000019EF4DC9A8B
I have some issues with postcss, maybe it's only postcss issues, I dont know.
I will directly add the main code to my project for seeing whats happen : o .
PS: i get the code and found in line 30 on hex.ts the only error I have (my configuration of tsconfig allow "any" or somes tricks with "!")
// return RegExpMatchArray | null so dangerous to desconstruct and make me error because you cannot deconstruct something null
const [r, g, b, a] = chunkString(hexLongWtihoutHashtag, 2)
Hi;
I read the doc but ... none function about construct Color with a string ......
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.