color_interpolation.rml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <rml>
  2. <head>
  3. <title>Color interpolation</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <meta name="Description" content="Color interpolation using animation, border-radius property, and gradient decorator." />
  6. <meta name="Assert" content="There should be smooth transitions between the colors. The red squares can be hovered for animation transitions." />
  7. <link rel="GitHub discussion #207" href="https://github.com/mikke89/RmlUi/discussions/207" />
  8. <style>
  9. body {
  10. background: #ddd;
  11. color: #444;
  12. }
  13. div {
  14. margin: 20dp auto;
  15. width: 100dp;
  16. height: 100dp;
  17. box-sizing: border-box;
  18. }
  19. .animate {
  20. background-color: #f00;
  21. transition: background-color 0.6s linear-in-out;
  22. }
  23. .animate:hover {
  24. background-color: #0f0;
  25. }
  26. .animate.black:hover {
  27. background-color: #000;
  28. }
  29. .wide {
  30. width: 300dp;
  31. }
  32. .rectangle {
  33. decorator: horizontal-gradient( #f00 #0f0 );
  34. }
  35. .round {
  36. decorator: horizontal-gradient( #f00 #0f0 );
  37. border-radius: 50dp;
  38. }
  39. .round-border {
  40. border-radius: 100dp;
  41. border: 15dp #000;
  42. border-color: #0f0 #f00 #0f0 #f00;
  43. }
  44. .rectangle.black {
  45. decorator: horizontal-gradient( #f00 #000 );
  46. }
  47. .round.black {
  48. decorator: horizontal-gradient( #f00 #000 );
  49. border-radius: 50dp;
  50. }
  51. .round-border.black {
  52. border-radius: 100dp;
  53. border: 15dp #000;
  54. border-color: #000 #f00 #000 #f00;
  55. }
  56. </style>
  57. </head>
  58. <body>
  59. <div class="animate"/>
  60. <div class="rectangle"/>
  61. <div class="round"/>
  62. <div class="round-border"/>
  63. <div class="rectangle wide"/>
  64. <div class="round wide"/>
  65. <div class="animate black"/>
  66. <div class="rectangle black"/>
  67. <div class="round black"/>
  68. <div class="round-border black"/>
  69. <div class="rectangle black wide"/>
  70. <div class="round black wide"/>
  71. </body>
  72. </rml>