Guest User

Untitled

a guest
Oct 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package rainbowhtml;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class rainbowhtml {
  8.  
  9. 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"};
  10. public static String input = null;
  11. public static String output = "";
  12.  
  13. static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  14.  
  15. public static void main(String[] args) throws IOException {
  16. System.out.println("Enter the text to be turned into rainbow html> ");
  17. input = reader.readLine();
  18.  
  19. for (int i = 0; input.length() > i; i++) {
  20. output += "<font color=" + colors[i % colors.length] + ">" + input.charAt(i) + "</font>";
  21. }
  22.  
  23. System.out.println(output);
  24.  
  25. }
  26. }
Add Comment
Please, Sign In to add comment