docs: def html_preview(colors, font_size=DEFAULT_FONT_SIZE,
                   bg_color=DEFAULT_BG_COLOR, bg_img=None,
                   fd=None):
      """
      Creates an HTML preview of each color.
  
      Returns the Python file object for the HTML file.
      """
  
      fd = fd or NamedTemporaryFile(mode='wt', suffix='.html', delete=False)
  
      # Initial CSS styling is empty
      style = ""
  
      # Create the main body
      body = '\n'.join(["""
          <div class="color" style="color: {color}">
              <div>█ {color}</div>
              <div style="color: {color_bold}">
                  <strong>█ {color_bold}</strong>
              </div>
          </div>
      """.format(color=hexify(c[0]), color_bold=hexify(c[1])) for c in colors])
  
      if bg_img:
          # Check if local or online image
          if os.path.isfile(bg_img):
              bg_img = os.path.abspath(bg_img)
  
          bg_url = "url('%s')" % (
              ('file://%s' % bg_img) if os.path.isfile(bg_img) else bg_img)
  
          # Add preview box and image to the body
          body = """
              <div id="preview-box" class="box-shadow">
                  <img id="preview-image" class="box-shadow" src="{bg_img}" />
                  {body}
              </div>
          """.format(**locals())
  
          # Add blurred background image styling
          style += """
              body:before {{
                  content: '';
                  position: fixed;
                  z-index: -1;
                  left: 0;
                  right: 0;
                  width: 100%;
                  height: 100%;
                  display: block;
  
                  background-image: {bg_url};
                  background-size: cover;
                  background-repeat: no-repeat;
                  background-position: center center;
                  background-attachment: fixed;
  
                  -webkit-filter: blur(2rem);
                  -moz-filter: blur(2rem);
                  -o-filter: blur(2rem);
                  -ms-filter: blur(2rem);
                  filter: blur(2rem)
              }}
          """.format(**locals())
  
      # CSS styling
      style += """
          body {{
              margin: 0;
              background: {bg_color};
  
              font-family: monospace;
              font-size: {font_size}rem;
              line-height: 1;
          }}
  
          #main-container {{
              padding: 1rem;
              text-align: center;
          }}
  
          #preview-box {{
              display: inline-block;
              margin: 3rem;
              padding: 1rem;
              background: {bg_color};
          }}
  
          #preview-image {{
              width: 100%;
          }}
  
          .color {{
              display: inline-block;
              margin: 1rem;
          }}
  
          .box-shadow {{
              -webkit-box-shadow: 0 0 1em 0 rgba(0, 0, 0, 0.75);
              -moz-box-shadow:    0 0 1em 0 rgba(0, 0, 0, 0.75);
              box-shadow:         0 0 1em 0 rgba(0, 0, 0, 0.75);
          }}
      """.format(**locals())
  
      # Write the file
      fd.write("""
          <!DOCTYPE html>
          <html>
              <head>
                  <title>
                      Colorscheme Preview
                  </title>
                  <meta charset="utf-8">
                  <style>
                      {style}
                  </style>
              </head>
              <body>
                  <div id="main-container">
                      {body}
                  </div>
              </body>
          </html>
      """.format(**locals()))
  
      return fd