Can't make custom palette
ThatOneCalculator opened this issue · comments
Kainoa Kanter commented
Code:
rose_pine = define_palette(
background = '#1f1d2e',
text = list(inner = '#555169', outer = '#e0def4'),
line = list(inner = '#e0def4', outer = '#c4a7e7'),
gridline = '#504940',
swatch = structure(c(
'#e0def4',
'#eb6f92', '#f6c177',
'#ebbcba', '#31748f',
'#9ccfd8', '#c4a7e7'), class = 'ggthemr_swatch'),
gradient = list(low='#31748f', high='#9ccfd8')
)
ggthemr(rose_pine)
Error:
Error in UseMethod("is_colour", x) :
no applicable method for 'is_colour' applied to an object of class "ggthemr_swatch"
Mattias commented
Looks like there's no generic function for checking if a ggthemr_swatch
is a colour, but using just a vector seems to do the trick. There were also some errors when using lists for the text and line parameters, again, just using vectors seems to have resolved that:
rose_pine <- define_palette(
background = '#1f1d2e',
text = c('#555169', '#e0def4'),
line = c('#e0def4', '#c4a7e7'),
gridline = '#504940',
swatch = c(
'#e0def4',
'#eb6f92', '#f6c177',
'#ebbcba', '#31748f',
'#9ccfd8', '#c4a7e7'),
gradient = c('#31748f', '#9ccfd8')
)