Colour Tools

Jan 16, 2004

I created some RGB-to-HSL and HSL-to-RGB functions for JavaScript that I think might be useful for some of you. function fnRgbToHsl(r, g, b){ // R G B as integers, 0..255.

r /= 255;
g /= 255;
b /= 255;
var
max = Math.max(r, g, b),
min = Math.min(r, g, b),
l = (max + min) / 2;
h = 0,
s = 0;
if(max != min){
s = (l < .5)?
(max - min) / (max + min):
(max - min) / (2 - max - min)
h = (max != r)?
(max != g)?
4 * (r - g) / (max - min):
2 * (b - r) / (max - min):
(g - b) / (max - min);
}
h *= 60;
if(h < 0)
h += 360;
return [h, s, l];
}

function fnHslToRgb(h, s, l){ // H as degrees 0..360, S L as decimals, 0..1.
h /= 360;
function fnHueToRgb(x, y, h){
if(h < 0)
h += 1;
else if(h > 1)
h -= 1;
return ((h * 6 < 1)?
x +(y - x) * h * 6:
(h * 2 < 1)?
y:
(h * 3 < 2)?
x + (y - x) * (2 / 3 - h) * 6:
x);
}
var
y = (l > .5)?
l + s - l * s:
l * (s + 1),
x = l * 2 - y,
r = fnHueToRgb(x, y, h + 1 / 3) * 255,
g = fnHueToRgb(x, y, h) * 255,
b = fnHueToRgb(x, y, h - 1 / 3) * 255;
return [r, g, b];
}

If I get the time, I'll build some tools around them, such as methods of getting triad colours, complementary and split complimentary colours, analogous colours, saturation variations, luminance variations (tints and shades) and hue variations (chromatic variations).

View 2 Replies


ADVERTISEMENT

Border Around An Object - Change The Background Colour And Font Colour Of Some Elements

Sep 22, 2009

I am using javascript code to change the background colour and font colour of some elements called 'filled') dynamically. For example:

if(timeInputValue >= startcode && timeInputValue < endcode && stateInput.value == "playing") {
filled.style.backgroundColor = '#ffffff';
filled.style.color = '#000000';
}

I also want to put a border around these 'filled' elements too - how can I do this is javascript? I can't find an equivelent to style.border = "1px"

View 1 Replies View Related

Set BG Colour And Than Change To Another Colour On Click?

Sep 7, 2010

How do I do this? I've set up javascript to change the background colour depending on what colour square the user clicks on, this is working fine.However, I want to be able to set an initial colour, other than white, and then let the user chose their own.

here is my code so far.

<script language="JavaScript">
<!--
function changeBGC(color){

[code]....

I want the page to be initially set to the brown colour, then I want the user to be able to choose their own colour.

View 6 Replies View Related

Change Text Link Colour / Restore Link Colour?

Apr 11, 2010

I'm trying unsuccessfully to get some text links to change & restore their colour.

[URL]

Referencing this link - there are 3 text links at the top of the page, which scroll to different anchor points on the same page.I need the following to happen: On hover, change colour (easy using css) On click link A, change colour When clicking link B, link A restores to original colour.

View 4 Replies View Related

Get IE Debugging Tools?

Mar 5, 2010

Microsoft Script Debugger has been depreciated.

What tools are recommended for debugging JS for IE? I'm only interested in IE7 and 8, but mostly 8.

There are plenty of tools for FF...

View 1 Replies View Related

Tools Script

Apr 8, 2004

Are there any free scripts out there that act like the tools that this forum use when inserting a message, like to make text bold, or insert link.

View 2 Replies View Related

Safari Development Tools?

May 1, 2007

In order of priority, I need the following for Safari:

* a debugger (with watch)
* a console (with errors and command line)
* Web Developer toolbar (edit css, validate local)
* DOM inspector (like Firebug or IE's DOM inspector). Firebug is awesome, though...
* Possibly a source editor
* anything else that is useful (like http://www.squarefree.com/jsenv/ or the other bookmarklets on squarefree.com that work for safari).


Does safari support hasOwnProperty now? What about named functions in object literals? syntax example:

Code:
{
f : function f() {}
}

View 3 Replies View Related

Jquery :: Tools Breaking Layout In IE7 And 8

Jul 17, 2010

I subcontracted a programmer who replaced my jquery.js with a different version of jquery. This version breaks my function, but my version breaks the layout. I have a function that works with

Code:
jquery.tools.min.js
But not with
Code:
jquery.js?ver=1.4.2

Here's is my function:
Code:
<SCRIPT type="text/javascript">
$(document).ready(function(){
$('.theVideoLink').click(function(e){
e.preventDefault();
$('#VideoContent').load($(this).attr('href'));
});
});
</script>

I need this code to work with
Code:
jquery.js?ver=1.4.2
But it doesn't. It works with
Code:
jquery.tools.min.js
But this jquery.tools.min.js breaks the layout in IE7&8.

View 3 Replies View Related

Best Obfuscation And Captcha Evaluation Tools

Dec 22, 2005

How to find the top 5 JavaScript obfuscation practices and tools? Are there tools able to combine multiple .js source files into one combined wholly obfuscated and hopefully compressed .js output file? Is it wise to obfuscate twice? and The top 5 CAPTCHA evaluation tools (don't necessary need to be javascript).

View 1 Replies View Related

Ofline Tools For Script Validation?

May 2, 2011

Is there any ofline tools for javascript validation.

Moderator says: no e-mail is allowed

View 1 Replies View Related

Validating Form Using Spry Tools

Oct 22, 2011

I am having problem in validating my form using spry tools. The problem is that if I try to include any other validation other than spry along with spry validation the spry validation does not work.

View 1 Replies View Related

JQuery :: Tools Scrollable - Goto Item?

Jan 9, 2010

Is there a way to 'activate' an item in the list of items inside Scrollable? The thing I want to accomplish is this: call the api.seekTo() method inside a piece of javascript (this part works) and then visualy show the user what item in the Scrollable list it was that was sought. I know I can influence the appearance of an item clicked but what I do want is tell the scrollable to activate an item (and scroll if neccecary to bring said item into view). So clicking I understand, telling or programaticaly setting the item _without_ clicking and make it stand out (by using the activeClass property).

But I need the scrollable to goto the particular item, in this case my project is a dj timetable for times, so if its currently 2pm, goto that item in the scroller on start - of course, there's PHP involved, so that'll be used, I've already got the item classed as .active, all I need is the scroller to go to that item automatically.

View 1 Replies View Related

Jquery :: Tools Gallery Doesn’t Works In IE

Dec 5, 2010

i downloaded a script from jquery tools which is the above: PHP Code:

$(".scrollable").scrollable();
$(".items img").click(function() {
// see if same thumb is being clicked
if ($(this).hasClass("active")) { return; }
// calclulate large image's URL based on the thumbnail URL (flickr specific)
var url = $(this).attr("src").replace("_t", "");
[Code]...

this doesnt works in i.e

View 1 Replies View Related

JQuery :: Nesting Tabs Inside Tools Scrollable?

Oct 13, 2010

if it's possible to nest tabs inside a scrollable from jQuery Tools. Basically, replacing the page content with a set of tabs. I've tried a few times, and with the jQuery native tabs, there must either be some JS or CSS conflicts that prevent things from working properly.

View 1 Replies View Related

Jquery :: Trying To Add Vertical Scrolling Functionality To Scrollable Tools

Nov 15, 2009

A little difficult to explain, but here goes:I've combined a couple different jquery scrollable functions to a webpage that I'm creating. URL...for my horizontal scrolling.The problem with the vertical scrolling function is that it relies on the mousewheel and mouse clicks for scrolling and I don't feel it's immediately apparent that the text scrolls. But I really like the effect, so I've added arrows and tried to get the functionality from the vertical scrolling example, but it's not working, except for the down arrow in the content in the very last tab. When you click on an arrow, it currently takes you to the previous or next horizontal section.

I know the answer is in there somewhere, but I'm not sure where to look for it. Here's the javascript file that controls the functionality:URL...

View 3 Replies View Related

JQuery :: Tools Tooltip Works On Imagemap Area In FF Only?

Jan 18, 2010

Some history: Although I know that it is considered 'old' technology, I have built hundreds of imagemaps over 10 years for a local photographer who uses a panoramic camera (now a spectacular digital one) to photograph weddings, schools etc. I then pop an imagemap area over each face and add a title (and alt text for IE viewers) that shows up on mouseover to identify the person.

I've been using the jQuery tools library recently and tried changing this tooltip demo which turns an image's title into a tooltip from:

$(document).ready(function() {
$("#demo img[title]").tooltip('#demotip');

To:

$(document).ready(function() {
$("#demo area[title]").tooltip('#demotip');

Thus grabbing the title associated with an area rather than an image.

I just built a quick proof of concept using the image map of a family meeting on one of my sites, and viewed it in Firefox. As expected, on hovering over an area the tooltip popped up at top center of the image, with the title text in it. Wow! GREAT! I thought. ;-)

BUT...

In IE: Tooltip pops up, containing the matching title text, but far away from the clicked area and NOT at top center.

In Opera: No tooltip, browser's title box opens by mouse position, but with out title text, instead it contains the a href link that clicking in the area would go to.

In Chrome: No tooltip, no title.

In Safari: No tooltip, no title.

(BTW All tests were done in current browser versions under Win XP)

I just tried Tero's demo at [URL] in all browsers and it worked fine, in every case the tooltip appeared top center of the image, with the title text in it! So it would seem at first thought to be involved with the way browser manufacturers have built their DOM... But further reading indicates that all post v5 browsers use the same DOM model, so I'm stumped. I've Googled quite a few threads where folk have had js/DOM/imagemaps conflicts, but have found no post resolving the issue.

Since libraries such as jQuery claim to isolate us from browser variances, is it just that imagemaps are considered so 'out of date' that browser manufacturers haven't bothered to update their code to integrate them into the standard DOM? (Bravo FF, 'does it right' again!)

View 4 Replies View Related

Jquery :: Tools / Scroll-able Make Fully Accessible

Nov 10, 2010

I want to make a list of divs into a vertical scrollable slider.Each div will consist of a small thumbnail image, a small title header and a link.I haven't started coding this yet but the above code should give you an idea of what I'm aiming for. The image thumbnails will be floated on the left, and the titles/links will be floated on the right.

I've been looking at the jQuery Scrollable script here and when I tested it with JS turned off, the rest of the content within the slider stayed hidden, instead of being visible and there was no way of viewing the rest of the content within the slider, other than the three images that were "in view".I would like to know if there's a way of making all the content within the slider visible all at once when JS is disabled. Is it possible to do this?

View 16 Replies View Related

Serving Up Compress Pages Without Access To Server Side Tools?

Jul 23, 2005

I have a website with no ssi, php, cgi...nothing. Plain old flat pages are all it serves.
I need to upload a list to it - a big, plain text list in html. A 2Mb list!

With gzip compress, it comes down to 91Kb, much more modem-friendly!

After about 30 minutes of googling, I haven't yet found a way of serving this page up like this.
I can't send headers as no php or .htaccess is allowed.

And please don't suggest I move to a "proper" web host! It's for a friend with a one-off need for a small website for about 2 months, and the freebie 10Mb is fine.

View 3 Replies View Related

Colour Changes

Oct 31, 2005

i have an image of a t-shirt and i want to use a colour picker type thing to change the images colour, is this possible, and if it is possible does anybody have any idea what code i would need for the script

View 1 Replies View Related

Text Colour

Jul 23, 2005

Being new to javascript, I'm stuck on what is obviously a simple thing.
I have a script which finishes with a document.write statement to
print the result to the screen. This is all working OK, but how do I
change the colour of the text and make it bold?

I tried adding style.color = "yellow"; before the write statement,
but the colour was still black.

View 3 Replies View Related

Alternate Row Colour

Dec 9, 2005

I am generating a html based table with multiple rows of data coming
in real time from a postgres DB. The underlying technology is java
based however the front end is html.

now i am unable to alternate the colour of every row so that the table
is lot more readable. can anyone suggest a javascript or even a css
script which will alternate the row colours irrespective of the number
of rows.

View 4 Replies View Related

Changing The Colour Of An <a> Tag?

Sep 8, 2011

The button is a blob of colour (.jpg) with text over the top. I want two things to happen: first, when the cursor is rolled over the .jpg and then the text, I want the text to change colour. This works ok. Second, I want to link to industry.php when clicked. This works ok over the .jpg but, obviously, not over the text.

[code = PHP]
echo '<div id="industry_button"><a href="industry.php" onmouseover="Roll_Industry(true)" onmouseout="Roll_Industry(false)">
<img name="Industry" src="graphics/industry_button.jpg" width="133" height="30" /></a>

[Code]....

View 4 Replies View Related

Changing Background Colour

Jul 23, 2005

I spotted some nice code to change the background colour of a web page to
one of four different colours at random but I can't find it now!

The method was to select a number at random from 1 to 4 by using the rnd()
function and then dividing by modulus 4. The result was then used to select
a cell in a 4 cell array which was holding a different colour in each cell
of the array. I would like to have this code but lack the knowledge to
re-create it.

View 4 Replies View Related

SSI Nav Bar But Page Name Cell A Different Colour?

Jul 20, 2005

My website formatting knowledge is mostly HTML; I know hardly any
Javascript. Recently I created a site with a nav bar in table format across
the top of the page, and I made the background colour of the cell with the
name of the page that the reader was on a different shade, like this:

Home | This | That | Other | Etc.

If you were on "Other" page, for example, the background colour of the
"Other" cell was a different shade from the others. I created this by
altering the code on each page.

This site was hosted with a web host that has SSI, and the nav bar became
the same file for every page, so we lost this minor navigation aid. Someone
mentioned that the same effect (a different colour or shade for the cell
with the page name) could be achieved with Javascript, but since I don't
know Javascript and we'd run out of time, we didn't do it.

Now I'd like to have this different colour for the page name cell at another
site using SSI for the nav bar. Is this possible? If so, how? To make it
even more fun, some of the page names are entry points to another section of
the site. If I can make "Other" a different colour, for example, I'd also
like to make pages in the "Other" folder have this same feature so that
readers know that they're in the "Other" section of the site. Or is this too
much?

View 2 Replies View Related

Get Background Colour Color?

Sep 10, 2009

I'm just trying to do something pretty simple which is an alert box which will give me the background color. So simple that it doesn't want to work, that is!

The line the body is onmouseover: <p id="metallic" onMouseOver="switchElementColour('metallic');">metallic c-prints</p>
The function is as follows
function switchElementColour(elementName){
var tryId = document.getElementById(elementName);
var yrf = tryId.style.backgroundColor;

[Code]...

View 4 Replies View Related

Changing Colour On Click?

Oct 3, 2011

How come this isn't working?

document.getElementById('glance').style.display='block'.color='gold';

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved