Jquery Plugin To Adjusting Text Color To Background Color

Adjust-Text-To-Background.js is a jQuery plugin to set the text color to the background color. If the background color is brighter, the script will change the text color to black, and if the background is darker, it will be changed to white.

Adjust-text-background js plugin to check the contrast ratio between text and background colors. The plugin automatically sets the font color of your text to black or white based on the perceived brightness of its original packaging.

Must Read: Simple jQuery Plugin for Embedding YouTube Videos As Cover Background

How to make use of it:

1. Load the JavaScript adjust-text-to-background.min.js after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/adjust-text-to-background.min.js"></script>

2. Call the function on the container.

<div class="adjust-text" style="background: rgb(3, 3, 32); ">
  <h1>Example text</h1>
</div>
$(function(){
  $('.adjust-text').adjustTextToBackground();
});

3. Customize the lightness utilized by the plugin to find out if the color is brilliant or darkish.

$(function(){
  $('.adjust-text').adjustTextToBackground({
    lightness : 0.60,
  });
});

See Demo And Download

adjust-text-to-background-js

Official Website(Hkozacz): Click Here

This superior jQuery/javascript plugin is developed by Hkozacz. For extra Advanced Usage, please go to the official website.

Related Posts

Fullscreen-Lightbox-Plugin

Simple And Powerful Fullscreen Lightbox Plugin | fslightbox

Fullscreen Lightbox Basic is a modern and handy plug-in for displaying photos and videos in a clean overlay box. Showcase a single source or create a great…

product-thumbnail-slider-with-zoom-effect-jquery

Product Thumbnail Slider With Positive Zoom Effect jQuery

Positive Zoom is a JavaScript library for creating an image gallery where you can zoom in on the current image by hovering over it. Must Read: Pure…

CSS-Gauge-Meter

Create Responsive Gauge Meter Using Pure CSS | CSSGauge

Pure CSS Gauge Meter Component, no SVG, or artboard is used in this component. This component can be easily distinguished by overriding the default style rules and…

bulma-datepicker

Versatile Date and Time Picker Calendar for Bulma

Bulma extension for calendar display can be used on a page as a large calendar with appointments or as a date picker/popup window. A responsive, customizable, and…

javascript-time-series-chart-library

Simple Time-Series Chart Viewer with HTML5 Canvas Javascript Library

Pixl chart library displays time series charts in the browser, using the HTML5 Canvas element. It is designed to be lightweight and efficient, while still providing a…

Neumorphic-Design-CSS

Neumorphic Design Inspiration Style CSS Shapes | Neumorphism

Multi-dimensional design is inspired by the physical world and adds textures, reflection, shadows, layers, and depths to the flat design making the UI elements more visible. CSS…