Get started with spectrum-i18n CDN

MIT licensed

Spectrum-i18n is a library for handling internationalization and localization in React applications.

Tags:
  • color
  • colorpicker
  • ui

Stable version

Copied!

How to start using spectrum-i18n CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with spectrum-i18n CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.14.0/spectrum.min.css" />
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.cdnhub.io/spectrum-i18n/1.3.0/jquery.spectrum-es.min.js"></script>
  <script>
    $(document).ready(function() {
      $('#colorpicker').spectrum({
        color: '#ff0000',
        showInitial: true,
        preferredFormat: "hex",
        localizationData: {
          es: {
            chooseText: "Elige un color",
            cancelText: "Cancelar",
            applyText: "Aplicar"
          }
        }
      });
    });
  </script>
</head>
<body>
  <button id="color-button">Select color</button>
  <input type="hidden" id="colorpicker" />
  <div id="color-preview"></div>
  <script>
    $('#color-button').click(function() {
      var color = $('#colorpicker').spectrum('get');
      $('#color-preview').css('background-color', color.toHexString());
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions