question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extended color theme

See original GitHub issue

Hey, super cool project that’s probably going to change a lot the way I currently use tailwind in some of my projects. I was already quite into Oceanwind, but this is really next level.

I quickly tried and put it head to head, reproducing the welcome example of https://play.tailwindcss.com/ into my favorite JS library and was blown away by how close it was… In fact, i’d even say it’s 1:1.

There’s one thing, however, that might be cool to add and I didn’t see any mention in the documentation. The extended color palette introduced in tailwind 2. As far as I understand, the default theme colors in twind is matching the default theme in tailwind, which only includes a small subset of colors. Here’s the full color list that was introduced in tailwind 2: https://github.com/tailwindlabs/tailwindcss/blob/master/colors.js.

For file size reason, I totally get that it shouldn’t be integrated within the default theme (that’s also probably why it wasn’t in tailwind by default, to trim down the compilation time), but I wonder if it could be possible to add like an extra exported object that contains those rules. e.g.:

import { setup, colors } from 'twind'
// or import colors from 'twind/colors';

setup({
  theme: {
    extend: {
      colors: { cyan: colors.cyan }
    }
  }
})

The only problem I suppose is to get good tree shakeability from an object so that you only pay for the color you use… I’m not sure if that’d be possible. I guess you could also export each and every color separately:

import { red, cyan, blue } from 'twind/colors';
// or import * as colors from 'twind/colors';

setup({
  theme: {
    extend: {
      colors: { red, cyan, blue }
    }
  }
})

That’s just a suggestion and I supposed one could also just copy and paste the the needed color from the original tailwind color palette as well.

Again, thanks for the library!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sastancommented, Dec 23, 2020

@amoutonbrady This has been merged and released in v0.8.0.

1reaction
sastancommented, Dec 23, 2020

Good idea. I’ll try that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing Colors - Tailwind CSS
Customizing the default color palette for your project. ... If you'd like to add a brand new color to the default palette, add...
Read more >
The color system - Material Design
This UI uses a color theme with a primary color, a primary variant, and a secondary color. Surface, background, and error colors.
Read more >
Extending Compose Material theme with more colors | Medium
First of all, we need something like the Colors class, which holds all the theme color values. We can't extend the built-in class, ......
Read more >
How to add new colors to tailwind-css and keep the original ...
Add your custom color values to theme > extend > colors section in tailwind.config.js //tailwind.config.js module.exports = { theme: ...
Read more >
Color - Foundations - Atlassian Design System
The extended palette consists of all the useable tints and shades of each color in the palette. They are all numbered for easy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found