{"id":13680514,"url":"https://github.com/mercuriev/bash-colors","last_synced_at":"2025-04-29T23:31:59.242Z","repository":{"id":1321241,"uuid":"1266253","full_name":"mercuriev/bash-colors","owner":"mercuriev","description":"The library defines verbal constants and functions for terminal colors.","archived":false,"fork":false,"pushed_at":"2024-11-23T05:00:28.000Z","size":22,"stargazers_count":126,"open_issues_count":0,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-23T06:17:04.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mercuriev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-01-18T06:55:22.000Z","updated_at":"2024-11-23T05:00:31.000Z","dependencies_parsed_at":"2022-08-16T13:05:18.617Z","dependency_job_id":null,"html_url":"https://github.com/mercuriev/bash-colors","commit_stats":null,"previous_names":["web3promax/bash_colors","mercuriev/bash-colors","loeul/bash-colors"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercuriev%2Fbash-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercuriev%2Fbash-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercuriev%2Fbash-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercuriev%2Fbash-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mercuriev","download_url":"https://codeload.github.com/mercuriev/bash-colors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251600458,"owners_count":21615714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:17.959Z","updated_at":"2025-04-29T23:31:56.149Z","avatar_url":"https://github.com/mercuriev.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"Bash colors\n===========\n\nThe library defines verbal constants for ANSII color codes.\nNow you can use words to tell bash what color you want to use for output.\n\nAlso, it defines functions to quickly output colored text.\nAs well as a function to display nice table of all colors.\n\nUpdated to allow for iterative output of colors by sequencing the color functions\n\n\nExamples\n--------\n\nPrint \"foobar\" with red foreground:\n```sh\n$ clr_red \"foobar\"\n```\n\nPrint \"foobar\" with green background:\n```sh\n$ clr_greenb \"foobar\"\n```\n\nPrint \"foobar\" with cyan foreground and bold font:\n```sh\n$ clr_bold clr_cyan \"foobar\"\n```\n\nStack functions on a single output to produce complex color configurations:\n```sh\n$ clr_red clr_blueb clr_reverse clr_underscore \"foobar\"\n```\n\nUsing the -n switch, the output can remain on a single line, allowing for changing colors across a line of text:\n```sh\n$ clr_redb clr_black \"RED\" -n; clr_blueb clr_black \"BLUE\" -n; clr_greenb clr_black \"GREEN\";\n```\n\nor Print \"foobar\" manually, using variables:\n```sh\n$ clr_escape \"foobar\" $CLR_BOLD $CLR_CYAN\n```\n\nor any other code:\n```sh\n$ clr_escape \"foobar\" 1 36\n```\n\n\nQuick start\n------------\n\n1. Download source\n```sh\n$ curl https://raw.githubusercontent.com/mercuriev/bash_colors/master/bash_colors.sh \u003e .bash_colors\n```\n\n2. Load into your script\n```sh\n$ source .bash_colors\n```\n\n\nVariables\n---------\n\n**$CLR_***\n\nVariables for each supported color code. E.g. $CLR_WHITE, $CLR_BLACK\nCall **clr_dump** for full list.\n\n**$CLR_ESC**\nis a special variable for escape code (\\033) followed by [ character.\n\n\nFunctions\n---------\n\n**clr_dump**\nOutput table of available colors, functions and variables.\n\n**clr_*** _string_\nFunctions for each supported color. E.g. clr_white, clr_black\nSee **clr_dump** for list.\n\n**fn_exists**\nGeneral bash function to check if string is a valid function\n\n**clr_layer**\nRecursive function allowing for muliple color functions in a sequence\n\n**clr_escape** _string_ _$CLR_ ...\nescape _string_ with given colors. Latest colors overwrites previous.\n\n**clr_reset**\nReset formatting. Useful for custom usage of $CLR_* variable series.\n\n\nSee also\n--------\n\nconsole_codes(4)\n[Advanced Bash Scripting Guide](http://tldp.org/LDP/abs/html/colorizing.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercuriev%2Fbash-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmercuriev%2Fbash-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercuriev%2Fbash-colors/lists"}