Enhancing the visibility of disabled form fields in Angular by increasing the contrast

Our application has the capability for users to print the form they submit. However, I noticed that disabled fields are not dark enough when printed.

I managed to make most fields print black, but I'm struggling to get the radio button text and drop-down field value to print in a darker shade. Currently, only the radio button circle and drop-down label are showing up as black.

Is there an easier way to achieve this? How can I style those two elements with CSS?

EDIT: The current solution uses a theme. When inspecting the computed CSS in Chrome, I noticed that the CSS rules I want to apply are overridden by other styles. I need help prioritizing the @media print section of my CSS. Here is a screenshot of the Chrome computed CSS

  @media print {
    input {
      color: black !important;
    }

    ::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
      background-color: black !important;
    }
    
    ::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle {
      background-color: black !important;   /*inner circle color change*/
    }
    
    ::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {
     border-color:black !important; /*outer ring color change*/
    }
    
    textarea {
      color: black !important;
    }

    label {
      color: black !important;
    }

    mat-label {
      color: black !important;
    }

    span {
      color: black !important;
    }

    div  {
      color: black !important;
    }
  }

Answer №1

This code snippet was implemented by me and it is functioning correctly.

::ng-deep.mat-radio-button.mat-accent.mat-radio-checked
  .mat-radio-outer-circle {
  border-color: #000000 !important;
}

::ng-deep.mat-radio-button.mat-accent .mat-radio-inner-circle,
.mat-radio-button.mat-accent
  .mat-radio-ripple
  .mat-ripple-element:not(.mat-radio-persistent-ripple),
.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-persistent-ripple,
.mat-radio-button.mat-accent:active .mat-radio-persistent-ripple {
  background-color: #555555 !important;
}

::ng-deep.mat-radio-button.mat-accent.mat-radio-checked
  .mat-radio-persistent-ripple {
  background-color: #333333 !important;
}

::ng-deep.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple) {
  background-color: #333333 !important;
}

To see a live demonstration, visit this link: https://stackblitz.com/edit/angular-tld6yn-uhgtkn?file=src%2Fapp%2Fradio-overview-example.css

Although using theming would be a better option, for now, this solution is effective.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Add a layer on top of the background in order to cover the entire screen

After researching various SO questions and answers, as well as examining different JSFiddle and Codepen examples, I have yet to find the solution I am looking for... Here is a sample fiddle of my current issue: https://jsfiddle.net/ts4t13hn/3/ Below is ...

Trouble with Bootstrap CSS buttons: color consistency problem persists

I am facing an issue with my Bootstrap button, which currently looks like this: https://i.sstatic.net/MWHYP.png The HTML code for the button in question is as follows: <button type="button" class="btn-primary.custom-btn" data-bs-to ...

Error: The browser threw a TypeError because Object(...) is not a function

I am having an issue with using Ionic Image Loader for image loading and caching. While there are no errors during compilation, I encounter the following error in the browser. Below are the details from my package.json file. As a newcomer to Ionic and Angu ...

Prevent alertCtrl from automatically triggering cancel in Ionic 2

I'm facing an issue with my alert controller where it opens momentarily and then closes unexpectedly without any user interaction. let alert = this.alertCtrl.create({ title: 'Requires Login', message: 'Please register or log ...

Tips for sending numerous forms within Stepper using Angular Material

I have utilized angular mat-stepper to create a multi-step form. Each step represents a different form, with a total of 3 steps. Here is an example: firstFormGroup: FormGroup; secondFormGroup: FormGroup; thirdFormGroup: FormGroup; fourthFo ...

Eliminating the issue of double scroll bars that overlap each other

Currently, I am developing a website that utilizes javascript, html, and css. One of the pages on the site displays all users as list items within an unordered list, which is nested inside two separate div elements. When accessing the page on my phone, bot ...

If there are no spaces, text will be removed from my list group

While working on developing a forum, I encountered an issue where if I repeatedly input letters or words without any spaces, it causes everything to overlap. Below is an example highlighting this problem: https://i.sstatic.net/KStNq.png Although there is ...

Ways to stack multiple DIV IDs on top of each other

Not quite sure how to phrase the title, but here it is. https://i.sstatic.net/d2dYB.png I want to shift the tables so that the headings are on the blue part of my page, while the body of the table remains in the grey section. I attempted using margin-bot ...

Calculating the total sum of an array utilizing filter and reduce techniques

How can I calculate the total value of all my products in the list by adding numbers together? this.totalValue = this.items.filter((item) => item.qtyvalue) .map((item) => item.qtyvalue) .reduce ...

Leveraging String Interpolation for Retrieving Array Values in Angular2 Application

In my Angular2 application, I have implemented a functionality where I loop through a list of users and display an icon to represent each user. Now, I want to enhance the user experience by using material2's tooltip (mdTooltip) feature to display the ...

Transforming a Bootstrap Background Image to a Captivating Video Display

Here is the CSS code snippet that I'm having trouble with: .masthead { position: relative; width: 100%; height: auto; min-height: 35rem; padding: 15rem 0; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 75% ...

javascript with emphasis on table

My friend shared a JavaScript code with me where he only bolded the time but not the text next to it. I am looking to bold both the time and the text next to it, as well as multiple tables if possible. var hour = new Date().getHours() + 1; $('tabl ...

Broaden the default className attribute of the component

Greetings! I'm currently using Bootstrap with React and I am trying to figure out how to extend my component by passing className props deeper. Within my atom component, I have two separate files. The first one contains the component declaration. B ...

Working with Angular: How to group multiple ng-templates and display or hide them based on conditions

There is a structure on a view that looks like this: <ng-template '#body'> <div *ngif="isAnswerA; else answerB"> <section>... </section> </div> <ng-template '#answerB'> <section>... </secti ...

"Encountering an error when trying to access undefined property in templates

The content displayed in my component template is not what I expected when using @Output to pass an object from a parent container. While attempting to bind {{selectedMovDetail|json}} in the template, the output shows as { "name": "The Walking Dead","rati ...

The image appears fuzzy until you hover over it and it transforms into a larger size

Encountering a strange issue with using the zoom property on an image during hover state. The image seems to be blurry before and after the scale transition, but surprisingly sharp during the actual transition. Any tips on how to prevent this blurriness in ...

Fluid image background failing to display properly in Firefox browser due to CSS compatibility issues

I'm currently working on implementing a fluid image background for one of my webpages. It's functioning perfectly in Chrome, but I can't seem to get it to work in Firefox. The goal is to have two squares with PNG images that resize proportio ...

What is the process for creating a hover effect on a button that is triggered when a user hovers over the button's parent container?

Visit this link to view the code My Goal: I want the hover effect that normally applies to buttons when hovered over, to instead be applied when a user hovers over the parent div containing those buttons. The parent divs in question have a class of "ser ...

Adding a class to an img tag with TinyMCE

Currently, I am utilizing the TinyMCE editor as a standalone editor in my content management system (CMS). Within the CMS, there is an automatic setting that adds a curved border to any image tags within the cms div ID. In certain cases, I require the op ...

Troubleshooting a Missing Call Display Issue in Angular2 API

Greetings, I am a new web developer and I have been tasked with creating a prototype Inventory Page using Angular2. Please bear with me as my code may not be perfect. In the snippet below, you'll notice that we are calling our base back-end API (&apo ...