<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: usama fouad</title>
    <description>The latest articles on Forem by usama fouad (@usamaeltmsah).</description>
    <link>https://forem.com/usamaeltmsah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F560694%2F24fb5c7c-1c24-45c7-ad61-12ca1f8a6e7a.jpeg</url>
      <title>Forem: usama fouad</title>
      <link>https://forem.com/usamaeltmsah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/usamaeltmsah"/>
    <language>en</language>
    <item>
      <title>Building sepia theme for mobile browser using CSS</title>
      <dc:creator>usama fouad</dc:creator>
      <pubDate>Tue, 21 Jun 2022 20:12:47 +0000</pubDate>
      <link>https://forem.com/usamaeltmsah/building-sepia-theme-for-mobile-browser-using-css-3ei4</link>
      <guid>https://forem.com/usamaeltmsah/building-sepia-theme-for-mobile-browser-using-css-3ei4</guid>
      <description>&lt;p&gt;I am building an &lt;strong&gt;iOS Safari extension&lt;/strong&gt; that inverts to different themes (Gray, Dark, and Sepia). Gray and Dark work well, but it doesn't work as expected for the &lt;strong&gt;Sepia&lt;/strong&gt; one. It change colors of not only the background, but also the content of the page.&lt;/p&gt;

&lt;p&gt;Here's the image with the issue:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wzb4dP_K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dynl97ah27ilfud8ah7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wzb4dP_K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dynl97ah27ilfud8ah7d.png" alt="Here's the image with the issue" width="880" height="1904"&gt;&lt;/a&gt;&lt;br&gt;
I want it not to invert the page content, and Here's the target image&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O6qjwPJb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym6z6qdd9foxvk5bw5rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O6qjwPJb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym6z6qdd9foxvk5bw5rk.png" alt="Here's the target image" width="880" height="1904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is my css files I inject to the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* sepia.css */

body {
    background-color: rgb(246, 240, 229) !important;
    filter: sepia(1) !important;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*dark.css*/

body {
    background-color: rgb(0, 0, 0) !important;
    filter: invert(1.0) hue-rotate(165deg) !important;
}

img,
video {
    filter: invert(1.0) hue-rotate(-165deg) !important;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*gray.css*/

body {
    background-color: rgb(75, 75, 75) !important;
    filter: invert(0.85) hue-rotate(165deg) !important;
}

img,
video {
    filter: invert(0.85) hue-rotate(-165deg) !important;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this is the javascript code I use to send (inject) the css file to the website.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//popup.js

insertCSS("sepia.css");

function insertCSS(file) {
    return new Promise((resolve, reject) =&amp;gt; {
        browser.tabs.insertCSS({ file }).then(resolve, reject);
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>extension</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
