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;
};
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;
}
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;
}
}

View File

@ -24,6 +24,8 @@ public:
eOutputMode m_bSelectedOutputMode = OUTPUT_HEX;
bool m_bFancyOutput = true;
bool m_bRunning = true;
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") {
currentlyParsing = 1;
continue;
} else if (arg == "--no-fancy") {
g_pHyprpicker->m_bFancyOutput = false;
} else {
Debug::log(NONE, "Unrecognized option %s", arg.c_str());
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();
return 0;