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