added fancy output

This commit is contained in:
vaxerski 2022-09-02 21:14:44 +02:00
parent 819195131b
commit db2aaa01de
3 changed files with 15 additions and 2 deletions

View file

@ -136,13 +136,19 @@ void Events::handlePointerButton(void *data, struct wl_pointer *wl_pointer, uint
return result; return result;
}; };
Debug::log(NONE, "#%s%s%s", toHex(COL.r).c_str(), toHex(COL.g).c_str(), toHex(COL.b).c_str()); if (g_pHyprpicker->m_bFancyOutput)
Debug::log(NONE, "\033[38;2;%i;%i;%im #%s%s%s", COL.r, COL.g, COL.b, toHex(COL.r).c_str(), toHex(COL.g).c_str(), toHex(COL.b).c_str());
else
Debug::log(NONE, "#%s%s%s", toHex(COL.r).c_str(), toHex(COL.g).c_str(), toHex(COL.b).c_str());
break; break;
} }
case OUTPUT_RGB: case OUTPUT_RGB:
{ {
Debug::log(NONE, "%i %i %i", COL.r, COL.g, COL.b); if (g_pHyprpicker->m_bFancyOutput)
Debug::log(NONE, "\033[38;2;%i;%i;%im %i %i %i", COL.r, COL.g, COL.b, COL.r, COL.g, COL.b);
else
Debug::log(NONE, "%i %i %i", COL.r, COL.g, COL.b);
break; break;
} }
} }

View file

@ -24,6 +24,8 @@ public:
eOutputMode m_bSelectedOutputMode = OUTPUT_HEX; eOutputMode m_bSelectedOutputMode = OUTPUT_HEX;
bool m_bFancyOutput = true;
bool m_bRunning = true; bool m_bRunning = true;
std::vector<std::unique_ptr<SMonitor>> m_vMonitors; std::vector<std::unique_ptr<SMonitor>> m_vMonitors;

View file

@ -15,6 +15,8 @@ int main(int argc, char** argv, char** envp) {
if (arg == "--format") { if (arg == "--format") {
currentlyParsing = 1; currentlyParsing = 1;
continue; continue;
} else if (arg == "--no-fancy") {
g_pHyprpicker->m_bFancyOutput = false;
} else { } else {
Debug::log(NONE, "Unrecognized option %s", arg.c_str()); Debug::log(NONE, "Unrecognized option %s", arg.c_str());
exit(1); exit(1);
@ -32,6 +34,9 @@ int main(int argc, char** argv, char** envp) {
} }
} }
if (!isatty(fileno(stdout)) || getenv("NO_COLOR"))
g_pHyprpicker->m_bFancyOutput = false;
g_pHyprpicker->init(); g_pHyprpicker->init();
return 0; return 0;