# Christmas hats component

**URL:** https://meta.discourse.org/t/christmas-hats-component/74853
**Category:** Theme component
**Created:** [November 27, 2017, 12:24am UTC](https://meta.discourse.org/t/christmas-hats-component/74853 "2017-11-27T00:24:53Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [November 27, 2017, 12:24am UTC](https://meta.discourse.org/t/christmas-hats-component/74853/1 "2017-11-27T00:24:53Z")

</div>

As Christmas approaches, you may want to add a bit of festive flair to your forum. So I present a (very simple) _Christmas hats_ theme:

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/c/8cc7620434c4047c3bc85cfb269931bb9c787b75.png) ![image](https://global.discourse-cdn.com/meta/original/3X/8/a/8aea43d93c5622235b7b56cc9123049a1e51f8ae.jpg)

A couple of notes:

- This theme assumes list avatars are 25x25 with a 2px border all round; you may need to tweak some of the positioning in the CSS for your avatars.
- It also assumes that thread avatars are 64x64 with a 2px border all round; again, tweak the positioning as you see fit.
- To avoid excessive festiveness, not all avatars in lists will be bedecked with Christmas cheer, but once you open up a thread, everyone is part of the fun.

(Aside: it looks like [I wasn’t the first to think of this](https://meta.discourse.org/t/christmas-hats/51846/10)!)

Enjoy!

| | | |
| --- | --- | --- |
| 🕶 | **Preview** | [Theme Creator](https://theme-creator.discourse.org/theme/Johani/christmas-hats) navigate to the latest / top pages or visit a topic page |
| 🔗 | **Github Repo** | [Discourse-Christmas-Hats](https://github.com/barryvan/discourse-christmas-hats) |
| 🛠 | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |

---

<div class="post-metadata">

### Author: ![Tumi](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Tumi](https://meta.discourse.org/u/Tumi)
#### Post date: [November 28, 2017, 5:50pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/2 "2017-11-28T17:50:49Z")

</div>

how to “install” it?

---

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [November 28, 2017, 11:34pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/3 "2017-11-28T23:34:38Z")

</div>

> [@Tumi](#):
>
> how to “install” it?

> [@Installing a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682):
>
> bookmark This is a guide for installing and managing themes and theme components in Discourse. person_raising_hand Required user level: Administrator Installing and customizing themes can significantly improve the look and feel of your Discourse site. You can easily import and manage themes and their components through the Discourse admin panel. This guide covers: Importing new themes and theme components Adding theme components to a theme Managing automatic updates Additional resourc…

😉

---

<div class="post-metadata">

### Author: ![Pawel\_Kosiorek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pawel_kosiorek/32/75785_2.png) [@Pawel\_Kosiorek](https://meta.discourse.org/u/Pawel_Kosiorek)
#### Post date: [December 6, 2017, 4:24pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/4 "2017-12-06T16:24:09Z")

</div>

Is it possible to add only hats to my current themes?

---

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [December 6, 2017, 9:48pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/5 "2017-12-06T21:48:34Z")

</div>

Yep! You can add it as a “theme component” to your existing themes. This is how I’m using it.

---

<div class="post-metadata">

### Author: ![Pawel\_Kosiorek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pawel_kosiorek/32/75785_2.png) [@Pawel\_Kosiorek](https://meta.discourse.org/u/Pawel_Kosiorek)
#### Post date: [December 7, 2017, 12:12pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/6 "2017-12-07T12:12:51Z")

</div>

Works like a charm, thank you!

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [August 26, 2018, 1:54pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/7 "2018-08-26T13:54:13Z")

</div>

is it possible to put the hat on a especial user? or on users of a especial group?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [November 6, 2018, 12:52am UTC](https://meta.discourse.org/t/christmas-hats-component/74853/9 "2018-11-06T00:52:13Z")

</div>

Is it still possible to use .dcstyle.json for components? If not we should get this fixed ASAP - Christmas hats all round!

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [November 6, 2018, 9:19am UTC](https://meta.discourse.org/t/christmas-hats-component/74853/10 "2018-11-06T09:19:19Z")

</div>

> [@Stephen](#):
>
> Is it still possible to use .dcstyle.json for components?

Yes, that’s still the format you get when you export a theme / component from the admin. There are two options to get this component up to date.

1. directly edit the file to add the component flag.
2. import the component, convert it, then export it again.

Either of those options will work to ensure that the component gets imported as a… well… component.

---

<div class="post-metadata">

### Author: ![Jason3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jason3/32/125743_2.png) [@Jason3](https://meta.discourse.org/u/Jason3)
#### Post date: [November 9, 2018, 8:45pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/11 "2018-11-09T20:45:09Z")

</div>

this is a great component. i was wondering, is there a way to add turkey wings to the profile pictures for thanksgiving?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [November 9, 2018, 8:50pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/12 "2018-11-09T20:50:23Z")

</div>

Sure, just prepare a PNG or gif with transparency, upload it and alter the CSS so that it refers to your image.

---

<div class="post-metadata">

### Author: ![Jason3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jason3/32/125743_2.png) [@Jason3](https://meta.discourse.org/u/Jason3)
#### Post date: [December 15, 2018, 11:53pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/13 "2018-12-15T23:53:26Z")

</div>

thank you for your help, my forums are loving all the Christmas themes and hat components.  
thank you for the great component to work off of, its awesome

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/6/167e1db0e451d74f8f669af3567c36aae004b703.png)

( is there anyway to add a gif instead of a pic? i would love to add flashing lights around profile pics )

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [December 16, 2018, 2:09am UTC](https://meta.discourse.org/t/christmas-hats-component/74853/14 "2018-12-16T02:09:09Z")

</div>

Sure, GIFs support transparency. If you can make it and align it then it should work fine AFAIK.

---

<div class="post-metadata">

### Author: ![Jason3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jason3/32/125743_2.png) [@Jason3](https://meta.discourse.org/u/Jason3)
#### Post date: [December 16, 2018, 4:54am UTC](https://meta.discourse.org/t/christmas-hats-component/74853/15 "2018-12-16T04:54:05Z")

</div>

it works absolutely perfect, thank you, my forums are filled with so much Holiday awesomeness, thank you

---

<div class="post-metadata">

### Author: ![jtbayly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jtbayly/32/119510_2.png) [@jtbayly](https://meta.discourse.org/u/jtbayly)
#### Post date: [December 19, 2018, 1:08pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/16 "2018-12-19T13:08:45Z")

</div>

Is anybody up for updating this to get it working on mobile?

---

<div class="post-metadata">

### Author: ![Jason3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jason3/32/125743_2.png) [@Jason3](https://meta.discourse.org/u/Jason3)
#### Post date: [December 19, 2018, 1:10pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/17 "2018-12-19T13:10:56Z")

</div>

this works on mobile on my site.  
i’ve changed it so there are 4 different type of hats the users can choose from

it works great

make sure you have it installed under “mobile”

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/6/c6622cdfb7f667e2a7daa918f7340e30e814490e.png)

and heres the css code i use

```
.topic-avatar {
  position: relative;
}

.topic-avatar > a::after {
  content: "";
  background-image: url($elf);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  position: absolute;
  top: -68%;
  left: -27%;
  width: 130%;
  height: 100%;
}

.topic-post:nth-of-type(2n) .topic-avatar > a::after {
  transform: rotate(-5deg) translateX(-4px);
}

.topic-post:nth-of-type(5n) .topic-avatar > a::after {
  transform: rotate(5deg) translateX(4px);
}

.topic-post:nth-of-type(3n) .topic-avatar > a::after {
  transform: scaleX(-1) rotate(5deg) translateX(-8px);
}

.topic-list .posters > a.latest {
  position: relative;
}

.topic-list .posters > a.latest::after {
  content: "";
  background-image: url($elf);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  position: absolute;
  top: -14px;
  left: -5px;
  width: 32px;
  height: 24px;
}

.topic-list tr:nth-of-type(3n) .posters > a.latest::after {
  transform: scaleX(-1);
  left: 2px;
}

```

---

<div class="post-metadata">

### Author: ![jtbayly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jtbayly/32/119510_2.png) [@jtbayly](https://meta.discourse.org/u/jtbayly)
#### Post date: [December 19, 2018, 1:15pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/18 "2018-12-19T13:15:03Z")

</div>

Odd. I have just installed the component from the GitHub repo, enabled it in my theme, and Santa hats show up on Desktop but not on mobile for me.

Also, I tried viewing the demo with the same results.

Edit: I’m on iOS. Perhaps it’s device specific?

---

<div class="post-metadata">

### Author: ![Jason3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jason3/32/125743_2.png) [@Jason3](https://meta.discourse.org/u/Jason3)
#### Post date: [December 19, 2018, 1:16pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/19 "2018-12-19T13:16:13Z")

</div>

i’m on IOS. i think if you install from GitHub, it installs only on desktop, you need to copy and paste and add it under “mobile”

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [December 19, 2018, 1:17pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/20 "2018-12-19T13:17:27Z")

</div>

Ideally someone could update the component to use Common instead of Desktop (so it applies to both automatically)

---

<div class="post-metadata">

### Author: ![jtbayly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jtbayly/32/119510_2.png) [@jtbayly](https://meta.discourse.org/u/jtbayly)
#### Post date: [December 19, 2018, 1:19pm UTC](https://meta.discourse.org/t/christmas-hats-component/74853/21 "2018-12-19T13:19:53Z")

</div>

Thanks for the help, I hadn’t read too carefully, and I’m not familiar with themes/components yet, so I was expecting it to “just work.” I’ll give it a shot with your instructions.

> [@cpradio](#):
>
> Ideally someone could update the component to use Common instead of Desktop

Yeah, that’d be nice. It’s a bit beyond my ability at the moment, I’m afraid, or I’d try to contribute back in that way.

[Next page](https://meta.discourse.org/t/christmas-hats-component/74853.md?page=2)
