enhance: adds rounded corners to the bg for the hex code

This commit is contained in:
bun137 2024-11-17 22:19:14 +05:30
parent ac1b4f2418
commit ea2eb95dd2

View file

@ -388,7 +388,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
// | |
// | --------- |
//
// (#hex code here)
// (hex code here)
cairo_restore(PCAIRO);
if (!m_bNoZoom) {
@ -430,12 +430,26 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
sprintf(hexBuffer, "#%02x%02x%02x", currentColor.r, currentColor.g, currentColor.b);
cairo_set_source_rgba(PCAIRO, 0.0, 0.0, 0.0, 0.5);
cairo_rectangle(PCAIRO, CLICKPOS.x, CLICKPOS.y + 20, 80, 30);
double x = CLICKPOS.x;
double y = CLICKPOS.y + 19;
double width = 89;
double height = 30;
double radius = 6;
cairo_move_to(PCAIRO, x + radius, y);
cairo_arc(PCAIRO, x + width - radius, y + radius, radius, -M_PI_2, 0);
cairo_arc(PCAIRO, x + width - radius, y + height - radius, radius, 0, M_PI_2);
cairo_arc(PCAIRO, x + radius, y + height - radius, radius, M_PI_2, M_PI);
cairo_arc(PCAIRO, x + radius, y + radius, radius, M_PI, -M_PI_2);
cairo_close_path(PCAIRO);
cairo_fill(PCAIRO);
cairo_set_source_rgba(PCAIRO, 1.0, 1.0, 1.0, 1.0);
cairo_select_font_face(PCAIRO, "monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(PCAIRO, 18);
cairo_set_font_size(PCAIRO, 20);
cairo_move_to(PCAIRO, CLICKPOS.x, CLICKPOS.y + 40);
cairo_show_text(PCAIRO, hexBuffer);