Search code examples
ioscsswebviewwkwebviewios-darkmode

DarkMode :- Color inverting not working for WKWebview Tableview Content


.css File

@media (prefers-color-scheme: dark) {
 :root {
        color-scheme: light dark;
    filter: invert(100%);
   -webkit-filter: invert(100%)
 }
}

This how it looks in WKWebView


Solution

  • After adding the table tag, table data color inverted properly

     @media (prefers-color-scheme: dark) {
         // root tag inverting all the components color except the table.
         : root {
                color-scheme: light dark;
            filter: invert(100%);
           -webkit-filter: invert(100%)
         }
        //table tag needed for inverting table content.
        table {
                filter: invert(100%);
         }
        }
    

    enter image description here