# Resolve final styles in email notifications

**URL:** https://meta.discourse.org/t/resolve-final-styles-in-email-notifications/310219
**Category:** Feature
**Tags:** email, pr-welcome, css
**Created:** [June 1, 2024, 11:09pm UTC](https://meta.discourse.org/t/resolve-final-styles-in-email-notifications/310219 "2024-06-01T23:09:19Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [November 28, 2024, 10:43pm UTC](https://meta.discourse.org/t/resolve-final-styles-in-email-notifications/310219/3 "2024-11-28T22:43:04Z")

</div>

If you feel like making a pull request, I’d happily merge it 👍

It doesn’t solve [this issue](https://meta.discourse.org/t/replying-in-iphone-mail-in-dark-mode-input-is-white-characters-on-white-background/281380) but having duplicate styling is wasteful and bug-prone anyways.

I would make some slight tweaks to the `deduplicate_style` function, mostly to make sure both the `key` and the `values` are present.

```ruby
def deduplicate_style(style)
  styles = {}

  style
    .split(";")
    .select(&:present?)
    .map { _1.split(":", 2).map(&:strip) }
    .each { |k, v| styles[k] = v if k.present? && v.present? }

  styles.map { |k, v| "#{k}:#{v}" }.join(";")
end

```

---

_[View the full topic](https://meta.discourse.org/t/resolve-final-styles-in-email-notifications/310219)._
