Skip to content

Commit

Permalink
Update doc and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Jan 8, 2025
1 parent 90ab640 commit f7e7709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ Hello Rainbow

This is useful for sharing the same code for logging to console and to a log file.

You can manually change this behavior by either:
You can manually change this behavior. Rainbow follows these rules in priority:

- Set the `Rainbow.enabled` in your code explicitly.
- Pass `FORCE_COLOR=1` to enable color even if the output is not a tty. ([`FORCE_COLOR`](https://force-color.org/) has a higher priority than `NO_COLOR`)
- Pass `NO_COLOR=1` as environment value when executing your app to disable color.
- Set the `Rainbow.outputTarget` yourself.
- Pass a `"NO_COLOR"` environment value when executing your app.
- Or set the `Rainbow.enabled` to `false`.


### Verbose Way

Expand Down
3 changes: 2 additions & 1 deletion Sources/Rainbow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public enum Rainbow {
}

/// Enable `Rainbow` to colorize string or not. Default is `true`, unless the `NO_COLOR` environment variable is
/// set and `FORCE_COLOR` not set. (`FORCE_COLOR` has higher priority than `NO_COLOR` if set)
/// set and `FORCE_COLOR` not set to a valid value ("0" or empty value is treated as "unset". `FORCE_COLOR` has
/// higher priority than `NO_COLOR` if set).
public static var enabled = environmentAvailable

public static func extractEntry(for string: String) -> Entry {
Expand Down

0 comments on commit f7e7709

Please sign in to comment.