void ColorPopup::setColor(const app::Color& color, const SetColorOptions options) { m_color = color; if (m_simpleColors) { int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); int a = color.getAlpha(); int i = g_simplePal->findExactMatch(r, g, b, a, -1); if (i >= 0) m_simpleColors->selectColor(i); else m_simpleColors->deselect(); } if (color.getType() == app::Color::IndexType) { if (m_colorPalette) { m_colorPalette->deselect(); m_colorPalette->selectColor(color.getIndex()); } } m_sliders.setColor(m_color); if (!m_disableHexUpdate) m_hexColorEntry.setColor(m_color); if (options == ChangeType) selectColorType(m_color.getType()); // Set the new color Shade shade = m_oldAndNew.getShade(); shade.resize(2); shade[1] = (color.getType() == app::Color::IndexType ? color.toRgb(): color); if (!m_insideChange) shade[0] = shade[1]; m_oldAndNew.setShade(shade); }