Discourse 크리스마스 장식 공유하기!

안녕하세요,

Discourse 헤더 아래에 추가할 수 있는 크리스마스 애니메이션 조명을 소개합니다.

이것은 Toby의 Codepen 크리스마스 조명 구현을 기반으로 합니다: https://codepen.io/tobyj/pen/QjvEex
Discourse에 맞게 코드를 조금 수정했습니다.

실제 적용 모습을 여기서 확인해 보세요: https://forum.monocycle.info/ (1월에 제거할 예정입니다)

스크린샷:

모바일 환경 (고정 헤더를 따라가지 않습니다):

다크 테마 사용 시:

Discourse에 추가하는 방법:

  1. 관리자 패널 → 커스터마이징 → 현재 테마 선택 → 사용자 정의 CSS/HTML로 이동하세요.
  2. CSS 탭에 다음 코드를 추가하세요:

/* Christmas Lights

   Copyright (c) 2019 by Toby (https://codepen.io/tobyj/pen/QjvEex)
   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

$globe-width:   12px;
$globe-height:  15px;
$globe-spacing: 40px;
$globe-spread: 3px;
$light-off-opacity: 0.4;
$speed: 0.5;

.lightrope {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  position: absolute;
  left: 0;
  z-index: 1;
  margin: -54px 0 0 0;
  padding: 0;
  pointer-events: none;
  width: 100%;
  li {
    position: relative;
    animation-fill-mode: both; 
    animation-iteration-count:infinite;
    list-style: none;
    margin: 0;
    padding: 0;
    display: block;
    width: $globe-width;
    height: $globe-height;
    border-radius: 50%;
    margin: $globe-spacing/2;
    display: inline-block;
    background: rgba(0,247,165,1);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,247,165,1);
    animation-name: flash-1;
    animation-duration: 2s;
    &:nth-child(2n+1) {
      background: rgba(0,255,255,1);
      box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,255,255,0.5);
      animation-name: flash-2;
      animation-duration: 0.4s;
    }
    &:nth-child(4n+2) {
      background: rgba(247,0,148,1);
      box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(247,0,148,1);
      animation-name: flash-3;
      animation-duration: 1.1s / $speed;
    }
    &:nth-child(odd) {
      animation-duration: 1.8s / $speed;
    }
    &:nth-child(3n+1) {
      animation-duration: 1.4s / $speed;
    }
    &:before {
      content: "";
      position: absolute;
      background: #222;
      width: ($globe-width - 2);
      height: $globe-height/3;
      border-radius: 3px;
      top: (0 - ($globe-height/6));
      left: 1px;
    }
    &:after {
      content: "";
      top: (0 - $globe-height/2);
      left: $globe-width - 3;
      position: absolute;
      width: $globe-spacing + 12;
      height: ($globe-height/3 * 2);
      border-bottom: solid #222 2px;
      border-radius: 50%;
    }
    &:last-child:after {
      content: none;
    }
    &:first-child {
      margin-left: -$globe-spacing/2-$globe-width;
    }
  }
}
@keyframes flash-1 { 
    0%, 100% { background: rgba(0,247,165,1);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,247,165,1);} 
    50% { background: rgba(0,247,165,$light-off-opacity);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,247,165,0.2);}
}
@keyframes flash-2 { 
    0%, 100% { background: rgba(0,255,255,1);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,255,255,1);} 
    50% { background: rgba(0,255,255,$light-off-opacity);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(0,255,255,0.2);}
}
@keyframes flash-3 { 
    0%, 100% { background: rgba(247,0,148,1);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(247,0,148,1);} 
    50% { background: rgba(247,0,148,$light-off-opacity);
    box-shadow: 0px $globe-height/6 $globe-width*2 $globe-spread rgba(247,0,148,0.2);}
}
/* mobile */
.mobile-view .lightrope {
    margin-top: -36px;
}
  1. 헤더 후(After header) 탭에 다음 코드를 추가하세요:
<ul class="lightrope">
<li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li>
</ul>

(4K 모니터의 전체 폭을 조명이 차지하도록 하려면 <li></li> 태그를 더 추가할 수 있습니다. 현재는 2k 모니터에 맞춰져 있습니다)

저장하고 즐기세요!

조명의 외관을 변경하려면 SCSS 코드 상단의 다음 변수를 수정하세요:

$globe-width:   12px;
$globe-height:  15px;
$globe-spacing: 40px;
$globe-spread: 3px;
$light-off-opacity: 0.4;
$speed: 0.5;
30개의 좋아요

정말 놀랍습니다. 제 디스커스 사이트에는 꼭 이걸 사용하겠습니다! :kiss:

3개의 좋아요

아바타에 착용할 클래식 산타 모자:


uihere.com에서 가져온 모자: G6gA3Wn

Discourse에 추가하는 방법:

  1. 관리자 패널 → 커스터마이징 → 현재 사용 중인 테마 선택 → 커스텀 CSS/HTML로 이동
  2. CSS 탭에 아래 코드를 추가하세요:
.main-avatar:after {
    content: url(https://i.imgur.com/G6gA3Wn.png);
    position: absolute;
    top: -5px;
    left: -19px;
}
.mobile-view .main-avatar:after {
    top: -17px;
}

(모자는 주제(topic) 뷰에서만 나타나야 합니다)

저장하고 모자를 즐기세요!

모자 이미지를 Discourse 서버에 직접 호스팅하는 것을 권장합니다.

14개의 좋아요

얼마 전에 @dax가 여기에 몇 가지를 올렸던 것 같은데, 아직 유효한가요?

5개의 좋아요

여기에는 또 다른 크리스마스 모자 튜토리얼이 있습니다: Christmas hats! - #7 by cpradio
크리스마스 모자 테마 컴포넌트: Christmas hats component
눈이 내리는 효과: Discourse snowing effect? - #4 by david
또 다른 눈이 내리는 효과와 로딩 이미지로 사용된 산타클로스 머리: https://meta.discourse.org/t/christmas-theme/36389

10개의 좋아요

한 주쯤 후에 이걸 적용해볼 생각에 벌써부터 설레네요. OP 감사합니다! :relaxed:

3개의 좋아요

추수감사절에는 그런 테마가 필요합니다.

1개의 좋아요

감사합니다! 크리스마스 아침에 불을 켤게요.

5개의 좋아요

각 플레어를 개별적으로 활성화/비활성화할 수 있는 다양한 크리스마스 장식 아이디어를 활용한 테마 컴포넌트를 만들었습니다.

6개의 좋아요

정말 좋은 아이디어였어요! 작년에는 크리스마스 플레어를 언급하자마자 "내 아바타에 그런 건 원치 않는다"고 말하는 사용자가 몇 명 있었습니다. 참, 시끄럽군. :neutral_face:

4개의 좋아요

대단하네요. 잘하셨습니다!

5개의 좋아요

Discourse의 고정 헤더 작동 방식이 변경되었기 때문에, 첫 번째 게시물의 크리스마스 조명도 더 이상 고정되지 않습니다.

하지만 큰 문제는 아닙니다.

또한, 오래된 여백(margin) 값도 수정했습니다.

3개의 좋아요