Home > Text-Prism

Text-Prism

Text-Prism is a project mainly written in JavaScript, it's free.

JQuery plugin to change the colors of text using words as colorstops when constructing a gradient.

Text Prism By: Sean Canton [email protected] Date: 6/22/11

Version 1

Overview: Changes colors in words using a word index based approach and RGB CSS generation.

Usage:

  1. Load JQuery, Load Plugin.

  2. Setup word index as array of word positions. ( 'cat' is at index 2 in "The lazy cat snoozed upon the grey sofa" ) EX: var wordIndex = [0, 4, 14];

  3. Setup color index as a nested array of RGB values EX: var colorIndex = [ [0,0,0], [120,120,120], [255,0,0] ];

  4. Call the plugin and pass in the settings.

$('#target').textPrism(wordIndex, colorIndex)

This will replace the HTML in #target with psuedo-spans around every word. This is what controls the color through a CSS3 :nth-of-type selector.

Previous:Zeus