adding ansi color codes
This commit is contained in:
@@ -6,17 +6,19 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/20 13:16:21 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/20 19:19:39 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <unstd/unique_ptr.h>
|
||||
#include <unstd/shared_ptr.h>
|
||||
#include <unstd/weak_ptr.h>
|
||||
#include <unstd/unique_ptr.hpp>
|
||||
#include <unstd/shared_ptr.hpp>
|
||||
#include <unstd/weak_ptr.hpp>
|
||||
#include <ansi.hpp>
|
||||
|
||||
int main(int ac, char** av)
|
||||
{
|
||||
(void)ac;
|
||||
(void)av;
|
||||
std::cout << AnsiColor::red << "this" << AnsiColor::blue << " is" << AnsiColor::green << " a" << AnsiColor::yellow << " test" << AnsiColor::reset << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
19
srcs/utils/ansi.cpp
Normal file
19
srcs/utils/ansi.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ansi.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/20 19:08:31 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/20 19:18:41 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <ansi.hpp>
|
||||
#include <unstd/string.hpp>
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const AnsiColor::Codes code)
|
||||
{
|
||||
return os << "\033[1;" << unstd::toString(static_cast<int>(code)) << "m";
|
||||
}
|
||||
Reference in New Issue
Block a user