Skip to content

Commit

Permalink
chore: changes sprintf to std::format
Browse files Browse the repository at this point in the history
  • Loading branch information
bun137 committed Nov 21, 2024
1 parent 6ba68b6 commit 2fa6623
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/hyprpicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,8 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
cairo_clip(PCAIRO);
cairo_paint(PCAIRO);

const auto currentColor = getColorFromPixel(pSurface, CLICKPOS);
char hexBuffer[8];
sprintf(hexBuffer, "#%02X%02X%02X", currentColor.r, currentColor.g, currentColor.b);
const auto currentColor = getColorFromPixel(pSurface, CLICKPOS);
std::string hexBuffer = std::format("#{:02X}{:02X}{:02X}", currentColor.r, currentColor.g, currentColor.b);

cairo_set_source_rgba(PCAIRO, 0.0, 0.0, 0.0, 0.5);

Expand Down Expand Up @@ -473,7 +472,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
cairo_move_to(PCAIRO, textX, CLICKPOS.y + 40);
}

cairo_show_text(PCAIRO, hexBuffer);
cairo_show_text(PCAIRO, hexBuffer.c_str());

cairo_surface_flush(PBUFFER->surface);
cairo_restore(PCAIRO);
Expand Down

0 comments on commit 2fa6623

Please sign in to comment.