Skip to content Skip to sidebar Skip to footer

How To Change The Colors Of Xdebug Output?

The red and yellow standard colors of xdebug can hurt your eyes after a few hours. http://www.designified.com/blog/article/76/restyling-xdebug-output describes how to replace the s

Solution 1:

The solution is the !important tag, it overrides the existing style values. Use the following css code to avoid eye cancer when using xdebug:

.xdebug-error {
    font-size: 12px!important;
    width: 95%!important;
    margin: 0 auto 10px auto !important;
    border-color: #666!important;
    background: #ddd!important;
}

.xdebug-errorth, .xdebug-errortd {
    padding: 2px!important;
}

.xdebug-errorth {
    background: #ccc!important;
}

.xdebug-errorspan {
    display: none !important;
}

.xdebug-error_descriptionth {
    font-size: 1.2em!important;
    padding: 20px4px20px100px!important;
    background: #ccc no-repeat left top !important;
}

.xdebug-error_callStackth {
    background: #666!important;
    color: #ddd!important;
}

Solution 2:

Have a nice xdebug!

Yes you can. Try this css below.

table.xdebug-error {
  width: auto;
  background: white;
  border: none;
  border-spacing: none;
  border-collapse: collapse;
  box-shadow: 0px3px10px0px black;
  position: fixed;
  top: 0px;
  right: 0px;
  z-index: 8888;
  font: 14px verdana;
  transform-origin: top right;
  transform: scaleX(0.4);
  opacity: 0.3;
  transition: all 200ms ease;
}
table.xdebug-errorcaption,
table.xdebug-errorth,
table.xdebug-errortd {
  text-align: left;
  vertical-align: middle;
}
table.xdebug-erroraimg {
  border: 0;
}
table.xdebug-error:focus {
  outline: 0;
}
table.xdebug-error pre {
  margin: 0;
}
table.xdebug-errortbodytrtd,
table.xdebug-errortbodytrth {
  border: none;
  border-bottom: 1px solid rgba(0,0,0,0.2);
  font-weight: normal;
}
table.xdebug-errortbodytrtd {
  padding: 3px!important;
  vertical-align: top;
}
table.xdebug-errortbodytrth {
  padding: 13px!important;
}
table.xdebug-errortbodytrtd:nth-of-type(1) {
  width: 5%!important;
}
table.xdebug-errortbodytrth[bgcolor='#f57900'] {
  font-weight: normal;
  background: steelblue;
  color: white;
}
table.xdebug-errortbodytrth[bgcolor='#f57900']span {
  display: none;
}
table.xdebug-errortbodytrfont[color='#00bb00'] {
  color: #005e00;
}
table.xdebug-errortbodytrtd small {
  display: none;
}
table.xdebug-errortbodytrtdi {
  padding-left: 12px;
}
table.xdebug-error:hover {
  transform: none;
  opacity: 1;
}

CONS:

  • Depending on your other css defs, you may have to fiddle a bit until it looks as promised.
  • It's not as beautiful as a Laravel/Symfony error

PROS:

  • You can see the actual page, despite the error. (Message will be dimmed and pushed on the right side, appearing on mouse hover.)

  • It's nothing more than CSS

  • You can even add it to your page via CSS Live Editor Plugin or something similar; therefore, no need to add to your own code

  • It won't break your styling, won't stuff a whole lot of text into a tiny container where the error happened, etc. - because it's position:fixed.

  • Pleasant to the eye - you'll end up throwing errors just to see it again :)

Screenshot of a styled xdebug output

Solution 3:

Another option is to disable xdebug from overloading var_dump. In the php.ini [XDebug] section add xdebug.overload_var_dump=0

Formatting the output is then up to you; one such way could be wrapping var_dump in your own debug function that prints <pre> tags.

Solution 4:

xdebug_css.png

// notice the line height, the padding(cellspacing), monospace font, font size, making readability better at least for me.//// A FILENAME : xdebug_stack_trace.css// // This is how the xdebug_stack_trace.css is called from the index.php page// // &lt;style&gt;&lt;?php require_once("./resources/css/xdebug_stack_trace.css");?&gt;&lt;/ style&gt;// // notice that on the line above there is a space between the slash// and the 'style', on the ending 'style' tag, otherwise the display// get all messed up when this page gets loaded.// // make sure that when you copy the 'style' line from here to the// index page, that you remove the extra space at the ending 'style'// tag of the index page.// +---------+---------+---------+---------+---------+---------+---------+// orange/black td header line// +---------+---------+---------+---------+---------+---------+---------+.xdebug-errorth
{
    font-family:monospace;
    font-weight:normal;
    font-size:15px;
    padding: 6px6px6px6px;
    border:1px solid black;
    background: #FFCC99;    // orangecolor:#000000;          // black 
}
// +---------+---------+---------+---------+---------+---------+---------+// black/white th header line// +---------+---------+---------+---------+---------+---------+---------+.xdebug-error > tr:first-child > th:first-child,
.xdebug-error > tbody > tr:first-child > th:first-child
{
    line-height:1.6em;
    padding: 10px10px10px10px;
    border:1px solid #000000;
    background: #000000;          // blackcolor:#FFFFFF;
}
// +---------+---------+---------+---------+---------+---------+---------+// green/black td content one or more lines// +---------+---------+---------+---------+---------+---------+---------+.xdebug-errortd
{
    font-size:14px;
    padding: 6px6px6px6px;
    border:1px solid green;
    background: #D1FFE8;          // light green
}
// +---------+---------+---------+---------+---------+---------+---------+

Post a Comment for "How To Change The Colors Of Xdebug Output?"