Skip to content

Commit

Permalink
allow for prefixing option to avoid messing with tailiwnd defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Graffis committed Mar 27, 2021
1 parent 46b1c29 commit 81b4706
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ Now all colors within dracula will require the dracula prefix
</div>
```

## Changing color names
You can just pull in some of the colors and add them to tailwind
```
const dracula = require('tailwind-dracula/colors')
theme: {
extend: {
colors: {
...dracula //adds all the colors
pinkish: dracula.buffy //just adds buffy with the name 'pinkish'
}
}
},
```

## Color Palette

Palette | Hex | RGB | HSL | ![Color Picker Boxes](https://draculatheme.com/static/img/color-boxes/eyedropper.png)
Expand Down
43 changes: 35 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
const plugin = require('tailwindcss/plugin')

module.exports = plugin(function({ theme }) {
module.exports = function (prefix, hard = false) {
let module = plugin(function({ theme }) {

}, {
theme: {
extend: {
colors: theme => (colors)
}
}
})
}, {
theme: {
extend: {
colors: theme => ({
[prefix ? prefix + '-darker' : 'darker']: '#282a36',
[prefix ? prefix + '-dark' : 'dark']: '#44475a',
[prefix ? prefix + '-light' : 'light']: '#f8f8f2',
[prefix ? prefix + '-blue' : 'blue']: '#6272a4',
[prefix ? prefix + '-cyan' : 'cyan']: '#8be9fd',
[prefix ? prefix + '-green' : 'green']: '#50fa7b',
[prefix ? prefix + '-orange' : 'orange']: '#ffb86c',
[prefix ? prefix + '-pink' : 'pink']: '#ff79c6',
[prefix ? prefix + '-purple' : 'purple']: '#bd93f9',
[prefix ? prefix + '-red' : 'red']: '#ff5555',
[prefix ? prefix + '-yellow' : 'yellow']: '#f1fa8c',
[prefix && hard ? prefix + '-nosferatu' : 'nosferatu']: '#282a36',
[prefix && hard ? prefix + '-aro' : 'aro']: '#44475a',
[prefix && hard ? prefix + '-cullen' : 'cullen']: '#f8f8f2',
[prefix && hard ? prefix + '-vonCount' : 'vonCount']: '#6272a4',
[prefix && hard ? prefix + '-vanHelsing' : 'vanHelsing']: '#8be9fd',
[prefix && hard ? prefix + '-blade' : 'blade']: '#50fa7b',
[prefix && hard ? prefix + '-morbius' : 'morbius']: '#ffb86c',
[prefix && hard ? prefix + '-buffy' : 'buffy']: '#ff79c6',
[prefix && hard ? prefix + '-dracula' : 'dracula']: '#bd93f9',
[prefix && hard ? prefix + '-marcelin' : 'marcelin']: '#ff5555',
[prefix && hard ? prefix + '-lincoln' : 'lincoln']: '#f1fa8c',
})
}
}
})

return module;
}

0 comments on commit 81b4706

Please sign in to comment.