|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en" dir="ltr"> |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <title>Themes - Steps</title> |
| 6 | + <meta |
| 7 | + name="viewport" |
| 8 | + content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" |
| 9 | + /> |
| 10 | + <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> |
| 11 | + |
| 12 | + <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> |
| 13 | + <script src="../../../../../scripts/testing/scripts.js"></script> |
| 14 | + <script nomodule src="../../../../../dist/ionic/ionic.js"></script> |
| 15 | + <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> |
| 16 | + <style> |
| 17 | + .grid { |
| 18 | + display: grid; |
| 19 | + grid-template-columns: repeat(4, 1fr); |
| 20 | + grid-row-gap: 20px; |
| 21 | + grid-column-gap: 20px; |
| 22 | + } |
| 23 | + |
| 24 | + .grid-item { |
| 25 | + font-size: 14px; |
| 26 | + font-weight: bold; |
| 27 | + } |
| 28 | + |
| 29 | + .color-tile { |
| 30 | + border: 1px solid #f2f2f2; |
| 31 | + height: 60px; |
| 32 | + width: 100%; |
| 33 | + cursor: pointer; |
| 34 | + } |
| 35 | + </style> |
| 36 | + </head> |
| 37 | + |
| 38 | + <body> |
| 39 | + <ion-app> |
| 40 | + <ion-header> |
| 41 | + <ion-toolbar> |
| 42 | + <ion-title>Themes - Steps</ion-title> |
| 43 | + </ion-toolbar> |
| 44 | + </ion-header> |
| 45 | + |
| 46 | + <ion-content class="ion-padding"> |
| 47 | + <h2>Gray</h2> |
| 48 | + <div id="gray" class="grid"></div> |
| 49 | + </ion-content> |
| 50 | + </ion-app> |
| 51 | + |
| 52 | + <script> |
| 53 | + document.addEventListener('DOMContentLoaded', function() { |
| 54 | + const grayContainer = document.getElementById('gray'); |
| 55 | + const bodyStyles = getComputedStyle(document.body); |
| 56 | + |
| 57 | + for (let i = 0; i <= 1000; i += 50) { |
| 58 | + const grayColor = `--ion-color-gray-${i}`; |
| 59 | + |
| 60 | + const colorValue = bodyStyles.getPropertyValue(grayColor).trim(); |
| 61 | + |
| 62 | + const gridItem = document.createElement('div'); |
| 63 | + gridItem.classList.add('grid-item'); |
| 64 | + |
| 65 | + const color = document.createElement('div'); |
| 66 | + color.classList.add('block', 'color-tile'); |
| 67 | + color.style.backgroundColor = `var(${grayColor})`; |
| 68 | + |
| 69 | + color.addEventListener('click', () => { |
| 70 | + navigator.clipboard.writeText(grayColor); |
| 71 | + console.log(`${grayColor} copied to clipboard`); |
| 72 | + }); |
| 73 | + |
| 74 | + gridItem.appendChild(color); |
| 75 | + |
| 76 | + const name = document.createElement('div'); |
| 77 | + name.textContent = `gray-${i}`; |
| 78 | + gridItem.appendChild(name); |
| 79 | + |
| 80 | + const value = document.createElement('div'); |
| 81 | + value.textContent = colorValue; |
| 82 | + gridItem.appendChild(value); |
| 83 | + |
| 84 | + grayContainer.appendChild(gridItem); |
| 85 | + } |
| 86 | + }); |
| 87 | + </script> |
| 88 | + </body> |
| 89 | +</html> |
0 commit comments