Compare commits

...

2 Commits

Author SHA1 Message Date
c0be40db0f added usage in script 2024-03-28 17:41:27 +03:00
7c86af8f0b added editorconfig 2024-03-28 17:24:38 +03:00
5 changed files with 30 additions and 6 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.sh]
indent_size = 2

View File

@ -1,6 +1,7 @@
MIT License MIT License
Copyright (c) 2023 Roman Ožana (https://ozana.cz/) Copyright (c) 2023 Roman Ožana (https://ozana.cz/)
Copyright (c) 2024 Alexander Popov (https://iiiypuk.me/)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.

View File

@ -2,6 +2,8 @@
Write colored text to the terminal easily. Write colored text to the terminal easily.
_Forker from https://github.com/OzzyCzech/colors.sh_
![Color palette](colors.png) ![Color palette](colors.png)
## Installation ## Installation
@ -9,7 +11,7 @@ Write colored text to the terminal easily.
Download `colors.sh` and source it in your script or copy/paste the functions and variables into your script. Download `colors.sh` and source it in your script or copy/paste the functions and variables into your script.
```shell ```shell
curl -O https://raw.githubusercontent.com/OzzyCzech/colors.sh/master/colors.sh wget https://git.a2s.su/iiiypuk/colors.sh/raw/branch/main/colors.sh
``` ```
## Usage ## Usage
@ -23,4 +25,4 @@ echo "This is ${RED}red text${NC}"
## License ## License
MIT [MIT License](LICENSE)

View File

@ -1,9 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script is used to define colors for bash scripts # This script is used to define colors for bash scripts
# GitHub: https://github.com/OzzyCzech/colors.sh # Git: https://git.a2s.su/iiiypuk/colors.sh
# Author: Roman Ožana <roman@ozana.cz> # Author: Alexander Popov
# License: MIT # License: MIT
# Update: 28 Mar 2024
# Usage:
#
# source colors.sh
# echo -e "This is ${RED}red text${NC}"
# Black and white # Black and white
export BLACK='\033[0;30m' export BLACK='\033[0;30m'

View File

@ -49,4 +49,4 @@ echo -e "${GRAY}----------------------------------------------------------------
echo "Every line will be prefixed with hostname and script name" echo "Every line will be prefixed with hostname and script name"
printf "${GREEN}%s${NC}\n" "This is green text" printf "${GREEN}%s${NC}\n" "This is green text"
printf "${RED}%s${NC}\n" "This is red text" printf "${RED}%s${NC}\n" "This is red text"
} | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}' } | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}'