stringForProfile function
Returns input processed for the given profile.
This mirrors the behavior of the upstream colorprofile writer:
- ColorProfile.ascii: strip all ANSI escape sequences
- ColorProfile.noColor/
ansi/ansi256: downsample SGR colors
Implementation
String stringForProfile(String input, ColorProfile profile) {
final p = _toInternalProfile(profile);
if (p == cp.Profile.noTty) return Ansi.stripAnsi(input);
if (p == cp.Profile.trueColor) return input;
return cp_downsample.downsampleSgr(input, p);
}