Skip to content

Commit 83d38e4

Browse files
committed
More adjustements
1 parent ca5749d commit 83d38e4

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/fn_colors.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ namespace Sass {
460460
bool hsl = h || s || l;
461461

462462
if (rgb && hsl) {
463-
error("Cannot specify HSL and RGB values for a color at the same time for `adjust-color'", pstate, traces);
463+
error("RGB parameters may not be passed along with HSL parameters.", pstate, traces);
464464
}
465465
else if (rgb) {
466466
Color_RGBA_Obj c = col->copyAsRGBA();
@@ -505,7 +505,7 @@ namespace Sass {
505505
bool hsl = h || s || l;
506506

507507
if (rgb && hsl) {
508-
error("Cannot specify HSL and RGB values for a color at the same time for `scale-color'", pstate, traces);
508+
error("RGB parameters may not be passed along with HSL parameters.", pstate, traces);
509509
}
510510
else if (rgb) {
511511
Color_RGBA_Obj c = col->copyAsRGBA();
@@ -559,7 +559,7 @@ namespace Sass {
559559
bool hsl = h || s || l;
560560

561561
if (rgb && hsl) {
562-
error("Cannot specify HSL and RGB values for a color at the same time for `change-color'", pstate, traces);
562+
error("RGB parameters may not be passed along with HSL parameters.", pstate, traces);
563563
}
564564
else if (rgb) {
565565
Color_RGBA_Obj c = col->copyAsRGBA();

src/fn_colors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Sass {
1313
#define DARG_U_BYTE(argname) get_arg_r(argname, env, sig, pstate, traces, 0.0, 255.0) // double
1414
#define DARG_R_BYTE(argname) get_arg_r(argname, env, sig, pstate, traces, - 255.0, 255.0) // double
1515
#define DARG_U_PRCT(argname) get_arg_r(argname, env, sig, pstate, traces, 0.0, 100.0) // double
16-
#define DARG_R_PRCT(argname) get_arg_r(argname, env, sig, pstate, traces, - 100.0, 100.0) // double
16+
#define DARG_R_PRCT(argname) get_arg_r(argname, env, sig, pstate, traces, - 100.0, 100.0, "%") // double
1717

1818
// macros for color related inputs (rbg and alpha/opacity values)
1919
#define COLOR_NUM(argname) color_num(argname, env, sig, pstate, traces) // double

src/fn_utils.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// sass.hpp must go before all system headers to get the
22
// __EXTENSIONS__ fix on Solaris.
33
#include "sass.hpp"
4+
#include "ast.hpp"
45

56
#include "fn_utils.hpp"
67
#include "util_string.hpp"
@@ -53,16 +54,16 @@ namespace Sass {
5354
return get_arg<Map>(argname, env, sig, pstate, traces);
5455
}
5556

56-
double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi)
57+
double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi, std::string unit)
5758
{
5859
Number* val = get_arg<Number>(argname, env, sig, pstate, traces);
5960
Number tmpnr(val);
6061
tmpnr.reduce();
6162
double v = tmpnr.value();
6263
if (!(lo <= v && v <= hi)) {
6364
std::stringstream msg;
64-
msg << "Expected " << v << " to be within ";
65-
msg << lo << " and " << hi << ".";
65+
msg << "Expected " << v << unit << " to be within ";
66+
msg << lo << unit << " and " << hi << unit << ".";
6667
error(msg.str(), pstate, traces);
6768
}
6869
return v;

src/fn_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace Sass {
5050
Number* get_arg_n(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // numbers only
5151
double alpha_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // colors only
5252
double color_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // colors only
53-
double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi); // colors only
53+
double get_arg_r(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, double lo, double hi, std::string unit = ""); // colors only
5454
double get_arg_val(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces); // shared
5555
SelectorListObj get_arg_sels(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, Context& ctx); // selectors only
5656
CompoundSelectorObj get_arg_sel(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, Context& ctx); // selectors only

0 commit comments

Comments
 (0)