Professional Web Applications Themes

Looping through the rainbow - Coldfusion - Advanced Techniques

Hey everyone, I am working on a project that requires a table to move gradually through the colors. So like the colors would go like this: 000000 000011 000022 000033 000044 000055 000066 000077 000088 000099 001100 002211 <cfparam name="counter0" default="1" type="string"> <cfparam name="counter1" default="9" type="string"> <cfparam name="counter2" default="" type="string"> <cfparam name="action" default="add" type="string"> <cfloop query="getitems"> <tr BGCOLOR="###counter0##counter0##counter1##counter1 ##counter2##counter2#"> <td><span class="style13">#getitems.item_name#</span></td> <cfif action EQ "add"> <cfif counter2 LT "9"> <cfset counter2 = #counter2# + '1'> <cfelseif counter1 LT "9" and counter2 EQ "9"> <cfset counter0 = #counter0# + '1'> <cfset counter1 = #counter1# + '1'> <cfset counter2 = '5'> <cfelse> ...

  1. #1

    Default Looping through the rainbow

    Hey everyone, I am working on a project that requires a table to move gradually
    through the colors. So like the colors would go like this:
    000000
    000011
    000022
    000033
    000044
    000055
    000066
    000077
    000088
    000099
    001100
    002211

    <cfparam name="counter0" default="1" type="string">
    <cfparam name="counter1" default="9" type="string">
    <cfparam name="counter2" default="" type="string">
    <cfparam name="action" default="add" type="string">
    <cfloop query="getitems">
    <tr
    BGCOLOR="###counter0##counter0##counter1##counter1 ##counter2##counter2#">
    <td><span class="style13">#getitems.item_name#</span></td>

    <cfif action EQ "add">
    <cfif counter2 LT "9">
    <cfset counter2 = #counter2# + '1'>

    <cfelseif counter1 LT "9" and counter2 EQ "9">
    <cfset counter0 = #counter0# + '1'>
    <cfset counter1 = #counter1# + '1'>
    <cfset counter2 = '5'>

    <cfelse>
    <cfset counter0 = #counter0# + '1'>
    <cfset counter1 = '5'>
    <cfset counter2 = '5'>
    </cfif>
    </cfif>

    with this code, when the variables get to 9, to continue in true hex form it
    needs to go to a, then b, then c, and of course you can't hold those charecots,
    because they are of course charectors. So I guess what i need is some loop that
    makes the numbers move all the way from 0 to F so i can really make good
    shading happen. Any ideas? I know this is kinda hard to grasp, basically I
    just want the table to move through the color spectrum seamlessly, and the
    problem is that I don't know how to use the letters in this loop that are
    needed to get all the hexideicmal colors.

    kenji776 Guest

  2. #2

    Default Re: Looping through the rainbow

    Google is your freind. Look what I found in less than a minute
    http://www.defusion.com/articles/index.cfm?ArticleID=109

    Think that might be useful?

    Originally posted by: kenji776
    Hey everyone, I am working on a project that requires a table to move
    gradually through the colors. So like the colors would go like this:
    000000
    000011
    000022
    000033
    000044
    000055
    000066
    000077
    000088
    000099
    001100
    002211

    <cfparam name="counter0" default="1" type="string">
    <cfparam name="counter1" default="9" type="string">
    <cfparam name="counter2" default="" type="string">
    <cfparam name="action" default="add" type="string">
    <cfloop query="getitems">
    <tr
    BGCOLOR="###counter0##counter0##counter1##counter1 ##counter2##counter2#">
    <td><span class="style13">#getitems.item_name#</span></td>

    <cfif action EQ "add">
    <cfif counter2 LT "9">
    <cfset counter2 = #counter2# + '1'>

    <cfelseif counter1 LT "9" and counter2 EQ "9">
    <cfset counter0 = #counter0# + '1'>
    <cfset counter1 = #counter1# + '1'>
    <cfset counter2 = '5'>

    <cfelse>
    <cfset counter0 = #counter0# + '1'>
    <cfset counter1 = '5'>
    <cfset counter2 = '5'>
    </cfif>
    </cfif>

    with this code, when the variables get to 9, to continue in true hex form it
    needs to go to a, then b, then c, and of course you can't hold those charecots,
    because they are of course charectors. So I guess what i need is some loop that
    makes the numbers move all the way from 0 to F so i can really make good
    shading happen. Any ideas? I know this is kinda hard to grasp, basically I
    just want the table to move through the color spectrum seamlessly, and the
    problem is that I don't know how to use the letters in this loop that are
    needed to get all the hexideicmal colors.



    Dan Guest

  3. #3

    Default Re: Looping through the rainbow

    Wow, I figured the odds where so low of having what I wanted I didn't bother checking. The only problem is I don't know how to use custom tags... man im dumb.
    kenji776 Guest

  4. #4

    Default Re: Looping through the rainbow

    If you like functions better than custom tags, they have one that does hex math
    at cflib.org. Put

    coldfusion hexadecimal math

    into the google text box.

    Originally posted by: kenji776
    Wow, I figured the odds where so low of having what I wanted I didn't bother
    checking. The only problem is I don't know how to use custom tags... man im
    dumb.



    Dan Guest

Similar Threads

  1. basic looping help (want to stop looping in layer)
    By hamish@sullivanparkmedia.com in forum Macromedia Flash
    Replies: 2
    Last Post: February 22nd, 05:34 AM
  2. Circle with rainbow color
    By daniel in forum Adobe Illustrator Windows
    Replies: 0
    Last Post: April 22nd, 04:29 PM
  3. Enhancing a rainbow
    By Marcus_Guerrero@adobeforums.com in forum Adobe Photoshop Elements
    Replies: 7
    Last Post: November 14th, 09:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139