14-day Cloud trial
Start today. For free.

One editor. 50+ features. Zero constraints. After your trial, retain the advanced features.

Try Professional Plan for FREE
PricingContact Us
Log InGet Started Free

How to create gold and silver text effects in TinyMCE

June 8th, 2023

4 min read

gold and silver color symbols and targets representing the gold text designs in TinyMCE.

Written by

Joe Robinson

Category

How-to Use TinyMCE

In design, shine effects are useful. Shine conveys luxury. It evokes feelings of high quality and rare metals (gold, silver, platinum, etc). And if your customers want effects, like gold or silver text effects, your app should be able to add that to your content. But can the app do this easily?

With TinyMCE as the rich text editor in your application, you can implement gold text effects and make content shine easily with its effortless customization. 

This article explains how gold and silver text effects can be implemented in TinyMCE. 

How to make gold text effects in CSS

The base of gold text effects is a linear gradient between two different colors. CSS background properties receive the linear-gradient function, which then progressively transitions the content between the two selected colors. Gold text effects only need a series of colors that create the illusion of a gold glow, for instance:

background-image: linear-gradient(
 to right,
  #462523 0,
  #cb9b51 22%, 
  #f6e27a 45%,
  #f6f2c0 50%,
  #f6e27a 55%,
  #cb9b51 78%,
  #462523 100%
);

How this works is, the linear-gradient CSS function combines with the background image property. The color property is set to transparent. Another CSS property is then added called background clip. These elements combine to create gold text effects by preventing the gold gradient background from appearing except through the letters that make up the text. 

In other words, the MDN documentation describes the background clip property as ‘painting’ the designated background inside the foreground text. It’s an essential CSS property to create gold text effects, and making gold text fonts.

Adding gold text font with TinyMCE

To test out gold text effects, the following demo shows how to set up a gold text font effect within TinyMCE:

  1. Create an index.html file, and add the following HTML to get the demo started:

touch index.html

And then copy and paste this content:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TinyMCE Gold Text Effect</title>
</head>
<body>
    <h1>Gold and silver text effects in TinyMCE rich text editor</h1>
    <textarea id="editor">
      <p class="gold-text">Gold Text</p>
    </textarea>
</body>
</html>
  1. Add TinyMCE to the HTML file with the following script tags. The first tag connects the demo to TinyMCE through the TinyMCE Cloud CDN link. The second tag contains the TinyMCE init script. Include your TinyMCE API key here in place of the no-api-key string.

<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
<script>
       tinymce.init({
         selector: '#editor',
         plugins: 'powerpaste casechange searchreplace autolink directionality advcode visualblocks visualchars image link media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker editimage help formatpainter permanentpen charmap linkchecker emoticons advtable export autosave',
         toolbar: 'undo redo print spellcheckdialog formatpainter | blocks fontfamily fontsize | bold italic underline forecolor backcolor | link image | alignleft aligncenter alignright alignjustify lineheight | checklist bullist numlist indent outdent | removeformat',
         content_css: '/style2.css'
       });
</script>
  1. Create a styles.css file, and copy the following CSS into it:

touch style.css

And then paste this CSS content:

body {
    padding: 0.5rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: #0b1826;
    }

.gold-text {
    color: transparent;
    font-family: 'Times New Roman',serif;
    letter-spacing: 5px;
    font-size: 32pt;
    background-image: linear-gradient(
          to right,
           #462523 0,
           #cb9b51 22%, 
           #f6e27a 45%,
           #f6f2c0 50%,
           #f6e27a 55%,
           #cb9b51 78%,
           #462523 100%
        );

    -webkit-background-clip: text;
    background-clip: text;
  }
  1. Use the TinyMCE content_css option to link to the style sheet:

tinymce.init({
      selector: '#editor',
      plugins: 'powerpaste casechange searchreplace autolink directionality advcode visualblocks visualchars image link media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker editimage help formatpainter permanentpen charmap linkchecker emoticons advtable export autosave',
      toolbar: 'undo redo print spellcheckdialog formatpainter | blocks fontfamily fontsize | bold italic underline forecolor backcolor | link image | alignleft aligncenter alignright alignjustify lineheight | checklist bullist numlist indent outdent | removeformat',
      content_css: '/style.css'
  1. Save the changes, and then load the demo in a browser (make use of the Python test server, or PHP test server if needed), and try out the Gold text:

The gold text effect working in TinyMCE

How to make silver text effect in CSS

For silver text, it can be hard to distinguish the specific shine of silver text from a general metallic effect. To save the silver shine, there are a few more CSS style effects that can give the design effect needed:

  1. Animation
  2. Keyframes, set to make a “shine” effect
  3. Linear-gradient again, with some additional values modifying it (in this case to right and 270deg)
  4. Background-clip again
  5. Background-position, to set the starting position of the silver backgrounds.
  6. Background-size, to set sizes of the backgrounds involved in the silver text effect.

The goal is to create some animation that recreates the mirror-finish, shine effect of polished silver under a light source. TinyMCE can support this kind of UI subtleties because of its flexibility.

Adding silver text font with TinyMCE

  1. Modify the index.html file to include some silver text content inside the text area:

        <textarea id="editor">
          <p class="gold-text">Gold Text</p>
          <p class="silver-text">Silver Text</p>
        </textarea>
  1. Add the following CSS to the style.css file to create the silver text effect with a shine:

@keyframes shine {
    0% {
     background-position: 110% 0%, 0 0;
       }
    100% {
     background-position: -10% 0%, 0 0;
       }
     }

.silver-text {
    color: #858585;
    font-family: 'Times New Roman',serif;
    letter-spacing: 5px;
    font-size: 32pt;
    @supports ((background-clip: text) or (-webkit-background-clip: text)) {
              color: transparent;
              background-image:
                linear-gradient(
                    to right,
                    transparent 0%,
                    transparent 45%,
                    white 50%,
                    transparent 55%,
                    transparent 100%),
                linear-gradient(
                    270deg,
                    #8c8c8c 1.3%,
                    #999 15%
                    #868686 29.6%,
                    #828282 29.6%,
                    #7d7d7d 31.8%,
                    #797979 31.8%,
                    #6a6a6a 38.9%,
                    #d3d3d3);
    background-position: 110% 0%, 0 0;
    background-size: 200% auto, auto;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 3s infinite ease-in-out alternate-reverse 4s;
  }
}
  1. Save the changes, and test out the new silver text effect:

Gold and silver text working together in TinyMCE

Tips for designing with gold and silver text effects

Why the CSS uses the @supports variable

The @supports CSS rule ensures that the silver text effects work across different browsers. Ensuring compatibility across different browsers is why both gold text effects and silver text effects created in the demo make use of -webkit-background-clip: text; and background-clip: text;

Not all browsers support background effects, so it’s important to set up multiple options to fall back on. 

Additional gold text effect and silver text effect demos

The demos in the previous sections are drawn from the following sources:

  1. Gold text effects from Coding Artists
  2. Silver text effects based on the demo created by Levrel on codepen

Some additional demos with gold and silver text effects:

  1. Gold text effects with animation from Ashfaq Ahmed
  2. Gold text effects by Mandy Michael on codepen

Text effects for TinyMCE

For some other text effects that you can set inside the TinyMCE text area, check out the following posts:

  1. How to style text in TinyMCE
  2. Neon fonts and glowing fonts in TinyMCE
  3. 3D text effects inside TinyMCE

You can contact us if you have any questions on how TinyMCE can help you reach your specific design goals with different text effects, or with any other UI areas that you need to customize.

DesignCSSTinyMCE
byJoe Robinson

Technical and creative writer, editor, and a TinyMCE advocate. An enthusiast for teamwork, open source software projects, and baking. Can often be found puzzling over obscure history, cryptic words, and lucid writing.

Related Articles

  • How-to Use TinyMCEApr 28th, 2022

    How to set up TinyMCE from the cloud

Join 100,000+ developers who get regular tips & updates from the Tiny team.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tiny logo

Stay Connected

SOC2 compliance badge

Products

TinyMCEDriveMoxieManager
© Copyright 2024 Tiny Technologies Inc.

TinyMCE® and Tiny® are registered trademarks of Tiny Technologies, Inc.