Replies: 1 comment 3 replies
-
Hey, I actually have couple of use cases where this would indeed come in handy. I also very much like the approach of eliminating the chaining and using in isolation. In the CLI I am building where I use ansis heavily for the TUI logic, I can see my using +1 on this |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello @panoply,
what do you think about
reset()
function?I know we can do without it, but in very rare cases it could be useful. Here are usage cases on GitHub.
The reset ANSI code doesn't have open/close codes, only single code
ESC[0m
.Currently behaviour
This doesn't make sense:
For example:
Output:
![image](https://private-user-images.githubusercontent.com/6752572/404401637-4af0e277-72b4-4ed9-ba60-799eca96072e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTUxMjYsIm5iZiI6MTczOTYxNDgyNiwicGF0aCI6Ii82NzUyNTcyLzQwNDQwMTYzNy00YWYwZTI3Ny03MmI0LTRlZDktYmE2MC03OTllY2E5NjA3MmUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTAyMDI2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDc5OTgxYmUyODkxZDJmN2QxZTg3NmUwZmIxZDQ0YzlkOGMzYzZkZTU0NjkwZGQ2ZTg2ZTJmZGU4NTAxZDQ0YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tp1kDjQ8_KBwAM7UhDRmW10PjSdM_1A8J7x5U_k6oR0)
My be it is a poor example, but if we want
reset
red color forunderline
and following text, e.g.:Output:
![image](https://private-user-images.githubusercontent.com/6752572/404401841-c9320b2d-496b-45d5-828b-502de95ae85a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTUxMjYsIm5iZiI6MTczOTYxNDgyNiwicGF0aCI6Ii82NzUyNTcyLzQwNDQwMTg0MS1jOTMyMGIyZC00OTZiLTQ1ZDUtODI4Yi01MDJkZTk1YWU4NWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTAyMDI2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGYxODJkNjNhYjNlNzFjYzEwYmJkZDJjODJlMTZhYWU0ZGI1ZTMxMWM1ZDNjYWExNmVjMDJiM2Q4N2M4YzUwNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.3Pvf2Jlg-g0hsee7gNsjGhb8PoJJrZnFxreztzRLM0E)
It would reasonable to use the
reset()
function instead of string wrapping:Idea
The
reset()
function without arguments should returnESC[0m
to reset the previous styles.This is the only case where handling of an absent argument makes sense, because all other functions must have an argument.
Beta Was this translation helpful? Give feedback.
All reactions