{"id":23646242,"url":"https://github.com/devel0/cf","last_synced_at":"2025-06-17T07:33:52.660Z","repository":{"id":267001298,"uuid":"899982826","full_name":"devel0/cf","owner":"devel0","description":"colorful console","archived":false,"fork":false,"pushed_at":"2024-12-21T09:34:39.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T18:49:02.298Z","etag":null,"topics":["color","console","csharp","logging","utility"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devel0.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-07T14:50:15.000Z","updated_at":"2024-12-21T09:34:43.000Z","dependencies_parsed_at":"2024-12-07T16:23:28.673Z","dependency_job_id":"168db21a-b14c-40bf-b5e1-d70e38262c85","html_url":"https://github.com/devel0/cf","commit_stats":null,"previous_names":["devel0/cf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devel0/cf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devel0","download_url":"https://codeload.github.com/devel0/cf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fcf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260314512,"owners_count":22990598,"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":["color","console","csharp","logging","utility"],"created_at":"2024-12-28T13:19:49.004Z","updated_at":"2025-06-17T07:33:52.634Z","avatar_url":"https://github.com/devel0.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# colorful\n\n![](doc/demo.png)\n\n## Introduction\n\nPurpose of this app is to allow an easy way to colorize logs,\na set of rules can be specified to match within regex and place color against these matches.\n\nTypical usage:\n\n```sh\njournalctl -f | cf\n```\n\nthis will color the log for things we configured in the default `~/.config/cf/default.json` config file or with one supplied at cmdline.\n\n```sh\ntail -f /app/var/log/dev.log | cf ~/.config/cf/php.json\n```\n\n## build from source\n\n```sh\napt install dotnet8\n\ngit clone https://github.com/devel0/cf\n\ncd cf\ndotnet publish\n```\n\nthen copy produced build single file\n\n`./src/bin/Release/net8.0/linux-x64/publish/cf`\n\nto some in path\n\n`/usr/local/bin`\n\n## synopsis\n\n```sh\ncf [--test=FG[,BG]] [--file=INPUTFILE] \u003cconfig-file\u003e\n\nOptions:\n    --test=[FG[,BG]]     prints out a sample with given hex color.\n    --demo               print color demo\n    --file=INPUTFILE     read from given input file instead of stdin\n\nDefault config file is /home/devel0/.config/cf/default.json\n```\n\n## default config\n\n```json\n[\n  {\n    \"Note\": \"pid\",\n    \"Foreground\": \"317444\",\n    \"Background\": \"\",\n    \"Regex\": [ \"[a-z0-9]+\\\\[(\\\\d*)\\\\]\" ],\n    \"GroupMatch\": true,\n    \"IgnoreCase\": false,\n    \"FullRow\": false\n  },\n  {\n    \"Note\": \"procname\",\n    \"Foreground\": \"d8e21d\",\n    \"Background\": \"\",\n    \"Regex\": [ \"[a-z0-9]+\\\\s([^\\\\s]*)\\\\[\\\\d*\\\\]\" ],\n    \"GroupMatch\": true,\n    \"IgnoreCase\": false,\n    \"FullRow\": false\n  }\n]\n```\n\nresult example\n\n![](./doc/sample.png)\n\n## example explained\n\n![](./doc/sample2.png)\n\n- `fullrow` matches all the row setting black background\n- `hours and service` matches dd:dd:dd or xxx.service setting foreground and background\n- `pattern1` matches `deactivated successfully` case-insensitive setting foreground\n- `pattern2` matches `success` case-insensitive settings foreground\n- `pid` matches the number inside square bracket with a regex containing a group thus using GroupMatch mode\n\n```json\n[\n  {\n    \"Note\": \"fullrow\",\n    \"Foreground\": \"\",\n    \"Background\": \"#000000\",\n    \"Regex\": [ \".*\" ],\n    \"FullRow\": true\n  },\n  {\n    \"Note\": \"hours and service\",\n    \"Foreground\": \"#42ff81\",\n    \"Background\": \"#06160b\",\n    \"Regex\": [ \"\\\\d\\\\d:\\\\d\\\\d:\\\\d\\\\d\", \"[^\\\\s]*\\\\.service\" ]\n  },\n  {\n    \"Note\": \"pattern1\",\n    \"Foreground\": \"#bc4bc6\",\n    \"Regex\": [ \"deactivated successfully\" ],\n    \"IgnoreCase\": true\n  },\n  {\n    \"Note\": \"pattern2\",\n    \"Foreground\": \"#f260ff\",\n    \"Regex\": [ \"success\" ],\n    \"IgnoreCase\": true\n  },\n  {\n    \"Note\": \"pid\",\n    \"Foreground\": \"#202020\",\n    \"Background\": \"#ffff00\",\n    \"Regex\": [ \"\\\\[(\\\\d+)]\" ],\n    \"GroupMatch\": true,\n    \"IgnoreCase\": true\n  }\n]\n```\n\n## configuration\n\nin the config json an array of these objects can be specified\n\n| field        | description                                                                                              |\n| ------------ | -------------------------------------------------------------------------------------------------------- |\n| `Note`       | free text to annotate the rule purpose                                                                   |\n| `Regex`      | c# regex                                                                                                 |\n| `Foreground` | hex color for matching text ( empty string to unchange )                                                 |\n| `Background` | hex color for matching text ( empty string to unchange )                                                 |\n| `GroupMatch` | if true any out of the first group match will not considered as a match. See default config for a sample |\n| `IgnoreCase` | if `true` regex search will case insensitive                                                             |\n| `FullRow`    | if `true` first rule matching will colorize entire matchin row                                           |\n\nNotes:\n- subsequent matches can override colors; if a rule matches it can override foreground or background or both depending on what rule set in config.\n\n## exitcodes\n\n| code | descr                                                 |\n| ---- | ----------------------------------------------------- |\n| 0    | ok                                                    |\n| 1    | config file not specified and default not found       |\n| 2    | config file specified not found                       |\n| 3    | unable to parse config file                           |\n| 4    | input file specified with `--input=` option not found |\n| 10   | `--test` option used                                  |\n| 100  | ctrl+c                                                |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevel0%2Fcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevel0%2Fcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevel0%2Fcf/lists"}