Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rainbowhtml;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class rainbowhtml {
- public static String[] colors = {"#FF00FF", "#FF02D1", "#FF008D", "#FF0065", "#FF0035", "#F20904", "#EC2F00", "#F86A00", "#FF8D06", "#FBD101", "#F5F600", "#D3FF00", "#96FF0B", "#5BFF00", "#2BFF00", "#00FF00", "#00FF31", "#00FF57", "#04FFA0", "#00FFCE", "#0EFFFF", "#00DAFF", "#009DBC"};
- public static String input = null;
- public static String output = "";
- static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- public static void main(String[] args) throws IOException {
- System.out.println("Enter the text to be turned into rainbow html> ");
- input = reader.readLine();
- for (int i = 0; input.length() > i; i++) {
- output += "<font color=" + colors[i % colors.length] + ">" + input.charAt(i) + "</font>";
- }
- System.out.println(output);
- }
- }
Add Comment
Please, Sign In to add comment