简体   繁体   English

某亮colors网页拒绝显示

[英]Certain bright colors refuse to display on a webpage

I have encountered a strange issue in which a webpage that I'm working on refuses to display certain colors that are too bright.我遇到了一个奇怪的问题,我正在处理的网页拒绝显示某些太亮的 colors。 First thing to point out the color can be seen by a naked eye it's not that I am setting a color that's too close to white so it appears as if it wasn't displaying.首先要指出颜色可以用肉眼看到,并不是我设置的颜色太接近白色,所以看起来好像没有显示。 The especially weird thing about this is that it worked just fine about a month ago when I checked the project last time.尤其奇怪的是,大约一个月前,当我上次检查该项目时,它工作得很好。 Now the entire project cannot display this color.现在整个项目无法显示这种颜色。 It's important to point out that any brighter color set with HEX, RGB or the default colors work without any issues.需要指出的是,使用 HEX、RGB 或默认 colors 设置的任何更亮的颜色都可以正常工作,这一点很重要。 Other variable defined colors also work.其他定义的变量 colors 也可以工作。 I have tried to change the color code to see and if I set any color code that is "bright" enough the color works.我试图更改颜色代码以查看,如果我设置了任何足够“明亮”的颜色代码,颜色就会起作用。 So far the page is not using any JS that could overwrite this and since any other color works I don't believe that the issue is in the code itself.到目前为止,该页面没有使用任何可以覆盖它的 JS,并且由于任何其他颜色都有效,我不认为问题出在代码本身。

I am using LESS as a preprocessor for CSS and so I am using color variables for the entire project.我使用 LESS 作为 CSS 的预处理器,因此我在整个项目中使用颜色变量。 This is my code defining the variables:这是我定义变量的代码:

@clr-brand: #e4002B;
@clr-primary: white;
@clr-secondary: #fff2f2;
//@clr-primary-dm: #242835;
//@clr-secondary-dm: #2c3040;
@clr-grey: #697684;
@clr-grey-dm: @clr-grey * 2;

The specific color that I am having problems with is the "@clr-secondary" which refuses to display no matter if it's a text, background or anything else.我遇到问题的具体颜色是“@clr-secondary”,无论它是文本、背景还是其他任何东西,它都拒绝显示。 It just doesn't work.它只是行不通。

As a demonstration this color codes displays just fine for example: #d9d9d9作为演示,此颜色代码显示得很好,例如:#d9d9d9

I then use mixins to assign the colors to classes which I then actively use to set the properties to elements in the HTML code.然后我使用 mixins 将 colors 分配给类,然后我主动使用这些类将属性设置为 HTML 代码中的元素。 This is an example for the background class assigned the color in my main.less file:这是在我的 main.less 文件中分配颜色的背景 class 的示例:

.bg-secondary{
  background-color: @clr-secondary !important;
}

I then use the class to set the background to an element.然后我使用 class 将背景设置为元素。 This is an example of my HTML setting the code to an element:这是我的 HTML 将代码设置为元素的示例:

<section id="company-impact">
        <!--Company impact text-->
        <div class="container-fluid d-flex align-items-center justify-content-center mt-3 height-50 bg-secondary">
            <div class="row">
                <div class="col text-center">
                    <h6 class="text-crimson font-bolder text-uppercase pb-2">the connection</h6>
                    <h1 class="text-black font-bolder mb-2">Explore our impact around <br class="media-mobile media-small">the globe.</h1>
                    <a href="#" class="hyperlink-static">Learn more
                        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-up-right" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="#E4002B" fill="none" stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z"/>
                            <line x1="17" y1="7" x2="7" y2="17" />
                            <polyline points="8 7 17 7 17 16" />
                        </svg>
                    </a>
                </div>
            </div>
        </div>
        <!--End of company impact text-->
    </section>

As you can see on this image https://pic.infini.fr/230vyICA/a4AVjs07.PNG the background is plain white and the color is not set.正如您在这张图片https://pic.infini.fr/230vyICA/a4AVjs07.PNG上看到的那样,背景是纯白色的,并且没有设置颜色。 PhpStorm itself tells me that the modified color code has been set to the bg-secondary class as you can see on this picture https://pic.infini.fr/BkwWoMY6/5UtmGej0.PNG I have no idea as to why this happens since it worked before and I haven't made any changes to the code. PhpStorm 本身告诉我修改后的颜色代码已设置为 bg-secondary class 正如您在这张图片中看到的https://pic.infini.fr/BkwWoMY6/5UtmGej0.PNG我不知道为什么会发生这种情况它以前工作过,我没有对代码进行任何更改。 If there has been an update to the web standards and I am missing something please let me know.如果 web 标准有更新并且我遗漏了一些东西,请告诉我。 If you see my error please alert me right away so that I can finally fix it!如果您看到我的错误,请立即提醒我,以便我最终修复它! I spend hours trying to figure this out but I just couldn't!我花了几个小时试图弄清楚这一点,但我就是做不到!

The background on the 1st image is NOT white but that your defined color is a little bit of different than white.第一张图片的背景不是白色,但您定义的颜色与白色有点不同。 your code is working!您的代码正在运行!

寻找谷歌颜色选择器 (fff2f2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM