void ColorPopup::onSimpleColorClick() { m_colorType.deselectItems(); if (!g_simplePal) return; app::Color color = getColor(); // Find bestfit palette entry int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); int a = color.getAlpha(); // Search for the closest color to the RGB values int i = g_simplePal->findBestfit(r, g, b, a, 0); if (i >= 0) { color_t c = g_simplePal->getEntry(i); color = app::Color::fromRgb(doc::rgba_getr(c), doc::rgba_getg(c), doc::rgba_getb(c), doc::rgba_geta(c)); } setColorWithSignal(color, ChangeType); }