Home > Software engineering >  Font color won't change below a certain shade
Font color won't change below a certain shade

Time:06-12

I'm creating a web app using Angular 12. In my nav menu, I want text to be a dark gray (#161413). However, my text color won't take below a certain shade. For example, I can make my text "medium" red (#670000), but cannot make it "dark" red (#450000) - the text simply appears white below that #67xxxx threshold. I've commented out all css (including my styles.css parent) and left only my navmenu class. As a side note: there seems to remain some css influence on my text because the medium red appears lighter than it should be - like some opacity setting.

.navbar {
  color: black!important;
  justify-content: center;
  height: 20vh;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div >
  <div  *ngIf="atHome">
    <button  routerLink="/">HOME</button> |
    <button  (click)="LeaveHome()" routerLink="/link1">LINK1</button> |
    <button  (click)="LeaveHome()" routerLink="/link2">LINK2</button> |
    <button  (click)="LeaveHome()" routerLink="/link3">LINK3</button>
  </div>
  <div  *ngIf="!atHome" (click)="ReturnHome()">
    <div  routerLink="/">
    </div>
  </div>
</div>

CodePudding user response:

looks like it works fine here. You are not giving us enough information. Show a complete snippet that showcases your problem

.navbar {
  color: red;
  justify-content: center;
  height: 20vh;
}

#a{
color:#450000;
background-color:white;
}

#b{
color:#670000;
background-color:white;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div >
  <div  *ngIf="atHome">
    <button id='a'  routerLink="/">HOME</button> |
    <button id ='b'  (click)="LeaveHome()" routerLink="/link1">LINK1</button> |
    <button  (click)="LeaveHome()" routerLink="/link2">LINK2</button> |
    <button  (click)="LeaveHome()" routerLink="/link3">LINK3</button>
  </div>
  <div  *ngIf="!atHome" (click)="ReturnHome()">
    <div  routerLink="/">
    </div>
  </div>
</div>

CodePudding user response:

Thanks for everyone's contribution. This one really had me stumped all morning and your confusion (as well as mine) as to why this seemingly simple snippet of code wasn't working forced me to think outside the box. I recently downloaded a firefox plugin called "darkreader" that makes a dark mode for every website I visit. This plugin has a slider to make dark shades brighter until they hit the forementioned threshold - at which point they are lightened.

  • Related