I have a status tag in my AA app that only some colors are showing up. Are there certain colors i can use or can't? can't find much information on this.
here is my orders_helper
module OrdersHelper
def priority_tag_for_order(order)
printonrails_status_tag order_priority(order), color_for_weight(order.priority)
end
def color_for_weight(weight)
case weight
when 'lowest'
:gray
when 'low'
:blue
when 'mid'
:yellow
when 'high'
:orange
when 'highest'
:red
end
end
end
In the repo you can see that only a few colours are available, namely green, orange and red.
.status_tag {
background: darken($secondary-color, 15%);
color: #fff;
text-transform: uppercase;
letter-spacing: 0.15em;
padding: 3px 5px 2px 5px;
font-size: 0.8em;
&.ok, &.published, &.complete, &.completed, &.green { background: #8daa92; }
&.warn, &.warning, &.orange { background: #e29b20; }
&.error, &.errored, &.red { background: #d45f53; }
}
If you want to add new ones, you will have to edit your active_admin.css.scss like so
body.active_admin {
.status_tag.blue { background: #63B8FF; }
}
Better to go with custom class approach
status_tag 'TAG', class: 'class'
We can override ActiveAdmin status_tag (Yes/No) style classes by defining our own style classes inside your active_admin.scss
. I'm using ruby '2.5.3'. I just wanted to style my Yes/No status_tags in different colors instead of default gray and this worked for me.
body.active_admin {
.status_tag.yes {
background: #a9c68d;
}
}
body.active_admin {
.status_tag.no {
background: #b3b3b3;
}
}
Now my dashboard looks like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With