body { color: #000000; background-color: #FFFFFF; }
JavaScript
// JavaScript Document
/**
* Basic functions for changing display table #jQuerySelectors
functions:
getRGB( ) alert window with fg,bg colors - used mainly for debugging
myInvert( Element str ); invert text of element
myHighlight( Element str, bg = "Yellow", border="3px solid lime" );
//set bg, and border of Element
halloween( Element tag ); HTML tag or event object to give Halloween theme
notHalloween( Element tag ); HtML tag or jQuery Event Object to clear Halloween theme
@author Professor Tom DeDonno
@date 9/2012, updated 10/2015
Tested and working on Firefox 40 IE 11, and Chrome 45.
modified 9/30 for jsFiddle compatiblity altered function name to variable = function
*/
getRGB = function( ) {
alert( "body fg: " + $("body").css( "color" ) +
" bg: " + $("body").css( "background-color" ) +
"\ntable#jQuerySelectors fg: " +
$( "table#jQuerySelectors" ).css( "color" ) + " bg: " +
$( "table#jQuerySelectors" ).css( "background-color" ) +
"\n#story1 fg: " +
$( "table#jQuerySelectors span#story1" ).css( "color" ) + " bg: " +
$( "table#jQuerySelectors span#story1" ).css( "background-color" ) );
//Note id uniquely identify an element on a Web Page
//Full path is more thorough, but prone to error
//Best practice ID is ID.
}
/* from http://jsfiddle.net/Mottie/xcqpF/1/light/ */
rgb2Hex = function(rgb){
rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
return (rgb && rgb.length === 4) ? "#" +
("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
}
/** invert foreground and background color,
note body has set colors, browser will use defaults inside table */
myInvert = function( str ) {
//element = $( "table#jQuerySelectors " + str );
var fg = $( str ).css( "color" );
var bg = $( str ).css(...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.