stringForProfile function

String stringForProfile(
  1. String input,
  2. ColorProfile profile
)

Returns input processed for the given profile.

This mirrors the behavior of the upstream colorprofile writer:

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);
}