Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

BUG: Changing from Light color to Dark (same)color does not work. #4

merged 1 commit into from Oct 23, 2012


None yet
2 participants

jnovack commented Sep 29, 2012

BUG: When changing from a Light color to the Dark same color, the dark color is not applied correctly. In the example below, the brackets and slash should be dark, the numbers light, and the word "background" should be invisible. Additionally, once blink is set, it should be unset by the dark color so the underline does not blink.

require 'Color2.php';
$c = new Console_Color2();
print $c->convert("%r[%R1%r/%R2%r] %1background%n %r%FBlink %r%UUnderline%n\n");

Running this code yields the first bracket as dark, the number 1 as light, and the rest of the output is colored in light making the word "background" visible (as light red on red). Additionally, "underline" is both blinking and underlined.

See reference image: http://cl.ly/image/0J1L3a2U0j2c (it's tough to get blinking working in static image)

PROBLEM: The colors were previously generating as \033[31;1m(light) and \033[31m(dark). In order for the style to be properly applied, the code should be generated with the style before the color AND the dark color should be applied with style normal.

FIX: This pull request solves this issue in two parts and properly generates \033[1;31m(light) and \033[0,31m(dark)

  • within color(), the color is checked and applied after the style.
  • within convert(), I forced the style to "normal" for the dark colors.

jnovack commented Sep 29, 2012

Side note, this is my first official patch to an official PEAR-hosted project. Exciting.

CloCkWeRX added a commit that referenced this pull request Oct 23, 2012

Merge pull request #4 from jnovack/fix-dark
BUG: Changing from Light color to Dark (same)color does not work.

@CloCkWeRX CloCkWeRX merged commit 771a5a4 into pear:master Oct 23, 2012


CloCkWeRX commented Oct 23, 2012


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment