mirror of https://github.com/polybar/polybar.git
parent
07b467cd38
commit
c1be785be7
|
@ -78,12 +78,13 @@ namespace drawtypes {
|
|||
} else if (m_gradient) {
|
||||
size_t color = 0;
|
||||
for (size_t i = 0; i < fill_width; i++) {
|
||||
if (i % m_colorstep == 0)
|
||||
if (i % m_colorstep == 0 && color < m_colors.size())
|
||||
m_fill->m_foreground = m_colors[color++];
|
||||
m_builder->node(m_fill);
|
||||
}
|
||||
} else {
|
||||
size_t color = math_util::percentage_to_value<size_t>(perc, m_colors.size() - 1);
|
||||
if (color < m_colors.size())
|
||||
m_fill->m_foreground = m_colors[color];
|
||||
for (size_t i = 0; i < fill_width; i++) {
|
||||
m_builder->node(m_fill);
|
||||
|
|
Loading…
Reference in New Issue