Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9014453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:30:38+00:00 2026-06-16T03:30:38+00:00

I have a variable I am passing through this loop in less that will

  • 0

I have a variable I am passing through this loop in less that will be used to name the class dynamically. Nevermind that this has the possibility of generating a heinous amount of classes, I am wondering why if I change the “red” variable to anything else in the function call or anywhere else, basically if they are not all the same, I get an “Object[object] has no method toCSS.

note: I am using the less app on mac to compile on save.

the mixin call:

.createShades (10, "red", #ff3333);

The mixin itself

// Generate our reds
.createShades (@index, @color, @base-color) when (@index > 0) {
    @i: @index;
    .createShade (@index, @i, @color, @base-color);
    .createShades (@index - 1, @color, @base-color);
}
.createShades (0, "red", @base-color) {}

.createShade (@index, @i, @color, @base-color) when (@i > 0) {
    @num: percentage((lightness(@base-color)/100) * (1 - (@i / @index)));
    @newShade: darken(@base-color, @num);
    (~".@{color}-@{i}-@{index}-text") {
        color: @newShade;
    }
    (~".@{color}-@{i}-@{index}-bg") {
        background-color: @newShade;
    }
    .createShade (@index, @i - 1, @color, @base-color);
}
.createShade (@index, 0, "red", @base-color) {}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:30:40+00:00Added an answer on June 16, 2026 at 3:30 am

    You need to change your ending mixin (used when the value reaches 0) to have @color instead of "red"). So…

    .createShades (0, @color, @base-color) {}
    .createShade (@index, 0, @color, @base-color) {}
    

    This is because it is seeking a match for “red” so when you change your call to another color, it throws an error since it does not match “red”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of functions that i am passing the same variable to,
I have a for loop which iterates through currentObject in response. This code: console.log(response[currentObject]);
I have a problem passing a variable through into a jquery function: function showImage(type,
Hello I have a Session ID variable I'm passing through from on Oracle package
I have an array of images that I want to loop through infinitely ie.
I have done urlencode of the variable before passing to the URL http://example.com/Restaurants?alias=F%26B But
I have this code below. As you can see I am passing two variables
I have variable @count of datatype int.I am setting values to this @count. I
I have problem passing a variable from a main page containing a user control
I have the following php object(??? new to this). It is being sent through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.