我正在尝试在Buefy / Bulma中自定义某些内容,我需要从SCSS映射中获取一些价值。我有以下内容:
df3 <- tibble(account_id = LETTERS[1:3],
date_general_ledger = ymd(c("2015-01-01", "2015-01-03", "2015-01-02")),
amount = c(110, 200, 50))
出于我的需要,我想从中获得第一个位置(仅$ white)
$colors:
(
"white": (
$white,
$black
),
...
);
现在我都得到了($ white,$ black)。 请帮忙–有没有办法仅从中获取“ $ white”变量的结果?
非常感谢。
答案 0 :(得分:0)
然后在这种情况下:
$white: #fff;
$black: #000;
$colors: (
white: (
$white,
$black,
),
);
@function returnColor($value) {
@return nth(map-get($colors, white), index(map-get($colors, white), $value));
}
body {
color: returnColor($white);
}
如果有多个嵌套地图,则:
$white: #fff;
$black: #000;
$red: red;
$invert: toLazy;
$colors: (
white: (
$white,
$black,
),
red: (
$red,
$invert,
),
);
@function returnColor($map, $value) {
@return nth(map-get($colors, $map), index(map-get($colors, $map), $value));
}
body {
background-color: returnColor(red, $invert);
color: returnColor(white, $white);
}
body {
background-color: toLazy;
color: #fff;
}