lukapeharda / tailwindcss-color-palette-generator Goto Github PK
View Code? Open in Web Editor NEWGenerate TailwindCSS color pallete from a single color
Generate TailwindCSS color pallete from a single color
Awesome library, thanks for sharing.
I might jump in here and fix these over the next few weeks, but no time at the moment. So just documenting for now.
I'm using this library in conjunction with PHPLeague color extrator to get the dominant color from an image, then convert to a tailwind palette, which can then dynamically theme parts of a site (using this concept, similar to yours tailwindlabs/tailwindcss#12640)
I'm more or less trying to emulate https://uicolors.app/create which works exceptionally well with all colors.
I've created a few methods to auto-adjust based on HSL, and when you adjust those colors above to 900 you get the Divide By Zero errors:
generateTailwindPalette('#06104B', 900)
generateTailwindPalette('#0B0E2D', 900)
I'll create a PR when I figure it out.
Hi there,
I'm hitting the following error, when trying to run getHex()
on a Color. Latest version of the package + PHP v8.0.11:
PHP Deprecated: Implicit conversion from float 0.5759627129540341 to int loses precision in A:\laragon\www\twenty-for\vendor\lukapeharda\tailwindcss-color-palette-generator\src\Color.php on line 234
Here's the method & hexcode I'm running:
$paletteGenerator = new PaletteGenerator;
$paletteGenerator->setBaseColor( Color::fromHex('007a33') );
return $paletteGenerator->getPalette();
Thanks for building this package! Handy concept, if I'm able to get it working. Let me know if there's anything else I can provide or help with, here.
Getting
Fatal error: Uncaught Error: Using $this when not in object context in /Users/jamesauble/Projects/wauble/wp-content/themes/wauble-tailwind/vendor/lukapeharda/tailwindcss-color-palette-generator/src/Color.php:85 Stack trace: #0 /Users/jamesauble/Projects/wauble/wp-content/themes/wauble-tailwind/template-parts/theme-css-vars.php(9): LukaPeharda\TailwindCssColorPaletteGenerator\Color::fromRgb(255, 255, 0) #1 /Users/jamesauble/Projects/wauble/wp-includes/template.php(772): require('/Users/jamesaub...') #2 /Users/jamesauble/Projects/wauble/wp-includes/template.php(716): load_template('/Users/jamesaub...', false, Array) #3 /Users/jamesauble/Projects/wauble/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #4 /Users/jamesauble/Projects/wauble/wp-content/themes/wauble-tailwind/template-parts/header.php(8): get_template_part('template-parts/...') #5 /Users/jamesauble/Projects/wauble/wp-includes/template.php(772): require('/Users/jamesaub...') #6 /Users/jamesauble/Projects/wauble/wp-includes/template.php(716): load_template('/Users/jamesaub...', false, Array) #7 /Users/jamesauble/Projects/wauble/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #8 /Users/jamesauble/Projects/wauble/wp-content/themes/wauble-tailwind/front-page.php(1): get_template_part('template-parts/...') #9 /Users/jamesauble/Projects/wauble/wp-includes/template-loader.php(106): include('/Users/jamesaub...') #10 /Users/jamesauble/Projects/wauble/wp-blog-header.php(19): require_once('/Users/jamesaub...') #11 /Users/jamesauble/Projects/wauble/index.php(17): require('/Users/jamesaub...') #12 {main} thrown in /Users/jamesauble/Projects/wauble/wp-content/themes/wauble-tailwind/vendor/lukapeharda/tailwindcss-color-palette-generator/src/Color.php on line 85
This some new strictness with PHP 8? I thought you couldn't use $this in a static function but I'm not very great at PHP OOP.
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.