Bug Tracker

Modify

Ticket #9377 (closed enhancement: plugin)

Opened 2 years ago

Last modified 15 months ago

jQuery static Color class would be useful for cross-platform color comparison

Reported by: keith.mcfarlane@… Owned by:
Priority: low Milestone: 1.next
Component: css Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

I recently noted that the following code is not browser safe:

var HTMLtag = ... ; HTMLtag . css ( 'color', 'red' ); if ( 'red' == HTMLtag . css ( 'color' ) )

...;

else

...

; It would be useful to have a jQuery . color ( String ) method thst creates a Color object with an instance method or boolean compare ( final Color color )

This is a very modest addition that would handle the css ( 'color' ) String return values of (inter alia ) 'rgb (255, 0, 0 ). 'red' and '#FF0000'. Obviously this could be extended to return RGBA. CMYK and other colr representations.

While this might be thought no core it's such a small addition that it might be though similar to jQuery . trim ( String ) ...

Change History

comment:1 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to plugin
  • Status changed from new to closed
  • Component changed from unfiled to css

jQuery officially supports the jQuery.color plugin:  https://github.com/jquery/jquery-color

e.g.  http://jsfiddle.net/rwaldron/RHwKF/

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.