I'm starting to get quite a bit of code in my project, which is in Android Studio, and I'm trying to make sure that it's all very easy to understand. I'm leaving lots of Javadoc comments, but the thing is, they all look the same! It's always black text, or the occasional blue for a TODO or bold for a param, but the designer in me wants to be able to color the text to add that extra dimension of information. I'd love to be able to see a block of green and know right away that any code right below that has to do with the UI for instance, without having to read.
I couldn't find anything about Javadoc colors in any of the resources online, and I tried messing with the Android Studio preferences, but I could only change the color of ALL the Javadoc body text, not anything more specific.
In Javadoc comments you can use a subset of the HTML tags, such as <b></b>
, <i></i>
, etc... In particular you can use the <font>
tag and its color
attribute to set the color in which your Javadoc text will be rendered. For instance:
/**
* Some UI doc:
* <p><font color="green">
* UI documentation and more ...
* <br>more ui ...
* </font>
* <p>And now some tech doc:
* <p><font color="blue">
* Technical documentation this way ...
* <br>more tech ...
* </font>
*/
public class Test {
...
}
will render like this in Android Studio:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With