// 
//     Licensed to the Apache Software Foundation (ASF) under one
//     or more contributor license agreements.  See the NOTICE file
//     distributed with this work for additional information
//     regarding copyright ownership.  The ASF licenses this file
//     to you under the Apache License, Version 2.0 (the
//     "License"); you may not use this file except in compliance
//     with the License.  You may obtain a copy of the License at
// 
//       http://www.apache.org/licenses/LICENSE-2.0
// 
//     Unless required by applicable law or agreed to in writing,
//     software distributed under the License is distributed on an
//     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
//     KIND, either express or implied.  See the License for the
//     specific language governing permissions and limitations
//     under the License.
//

= DevFaqOWColorText
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqOWColorText
:description: Apache NetBeans wiki DevFaqOWColorText
:toc: left
:toc-title:
:syntax: true

== How to use color text in Output Window

You can use IO extension classes like `IOColorPrint`, `IOColorLines`. Default colors can be changed via `IOColors`.

[source,java]
----

InputOutput io = IOProvider.getDefault().getIO("test", true);

// change default color for output in corresponding tab
if (IOColors.isSupported(io)) {
    IOColors.setColor(io, IOColors.OutputType.OUTPUT, Color.GRAY);
}

// print line in specific color
if (IOColorLines.isSupported(io)) {
    IOColorLines.println(io, "Green line", Color.GREEN);
}


class L implements OutputListener {
//...
}

// print parts of line in specific color
if (IOColorPrint.isSupported(io)) {
    IOColorPrint.print(io, "Green part", Color.GREEN);
    IOColorPrint.print(io, " pink part", Color.PINK);
    IOColorPrint.print(io, " hyperlink with custom color", new L(), false, Color.MAGENTA);
}
----

See link:http://plugins.netbeans.org/plugin/39695/?show=true[here] for a plugin that has a convenient class that takes care of the dirty work and even handles `OutputListeners`.

<hr/>
Applies to: NetBeans 6.7 or later, (IOColorPrint 6.8 or later).

=== Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.

This page was exported from link:http://wiki.netbeans.org/DevFaqOWColorText[http://wiki.netbeans.org/DevFaqOWColorText] , 
that was last modified by NetBeans user Jhavlin 
on 2011-12-12T13:36:25Z.


*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.
