본문 바로가기
590. 기반연구/About Tistory

[백업] 블로그 다크모드 & UI 커스터마이징 (25.04.21.)

by 만년교생 2025. 4. 21.

현재 적용된 CSS의 추가 사항은 다음과 같다.


/*
===================================================================
만년교생의 티스토리 블로그 다크모드 & UI 커스터마이징 스타일 정리
===================================================================

📌 이 문서는 다크모드 환경에서 티스토리 블로그를 보다 깔끔하고 일관되게 보이도록 하기 위해 적용한 CSS를 정리한 것입니다. 
📌 ChatGPT를 활용하여 작성되었으며, 디테일한 수정을 위해 오리지널 CSS에도 수정이 들어갔습니다. 

🧩 주요 목적:
- 전체 배경 및 텍스트 색상 통일
- 헤딩 스타일 색상 커스터마이징
- hover 시 레이아웃 깨짐 방지
- 사이드바 및 썸네일 영역의 통일감 유지

⚠️ 주의사항:
- 모든 색상은 `prefers-color-scheme: dark` 조건에서만 작동합니다.
- 스킨 구조마다 class명이 다를 수 있으므로 반드시 사전 테스트 필요
- `!important`는 필요한 경우에만 사용하며, 우선순위가 꼬일 수 있으니 주의

*/
/* ===================================================================
   1. 다크모드 전체 스타일 적용
=================================================================== */
@media (prefers-color-scheme: dark) {

  /* 공통 배경 및 텍스트 */
  body,
  .comment-list ul li ul {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    font-family: 'Pretendard', ChosunGu;
  }

  /* 헤더 제목 영역 */
  #header h1 {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
  }

  /* 사이드바 및 링크 영역 */
  .box_header .link_logo,
  .area_sidebar .tt_category,
  .area_sidebar .link_item,
  .area_sidebar .link_sub_item,
  .area_sidebar .t_menu_home a,
  .area_sidebar .t_menu_tag a,
  .area_sidebar .t_menu_guestbook a,
  .area_sidebar .link_tool,
  .area_sidebar .link_add,
  .area_sidebar .btn_close,
  .area_popup .link_logo {
    color: #e0e0e0 !important;
  }

  /* 검색 돋보기 아이콘 */
  #header .util .search::before {
    background-color: transparent !important;
    border: none !important;
    filter: brightness(0.8) !important;
  }

  /* 본문 헤딩 스타일: 파스텔 계열 색상 사용 */
  #content h1, #content h2, #content h3,
  #content h4, #content h5, #content h6 {
    margin-top: 1em;
    margin-bottom: 0.3em;
    font-weight: bold;
    font-family: 'Pretendard', ChosunGu;
  }

  #content h1 { font-size: 1.5em; color: #f28b82 !important; }
  #content h2 { font-size: 1.4em; color: #ffb74d !important; }
  #content h3 { font-size: 1.3em; color: #fff176 !important; }
  #content h4 { font-size: 1.2em; color: #81c784 !important; }
  #content h5 { font-size: 1.1em; color: #64b5f6 !important; }
  #content h6 { font-size: 1.0em; color: #9575cd !important; }

  /* 본문 링크 스타일 */
  #content a:link {
    color: #b6cdfb !important;
  }
  #content a:visited {
    color: #fed8ff !important;
  }
  #content a:hover,
  #content a:active {
    text-decoration: underline !important;
  }

  /* 본문 외 링크 스타일 */
  a:not(#content a) {
    color: #e0e0e0 !important;
    text-decoration: none !important;
  }
  a:not(#content a):hover,
  a:not(#content a):active {
    color: #ffffff !important;
    text-decoration: underline !important;
  }

  /* 기타 공통 UI 영역 배경 처리 */
  .info_profile,
  .list_toolbar,
  .wrap_list,
  .area_sidebar .inner_sidebar,
  .area_popup,
  textarea,
  #wf-form,
  #container .wf-form {
    background-color: #2a2a2a !important;
    color: #e0e0e0 !important;
  }

  /* GNB 영역 제거 */
  #gnb {
    display: none !important;
  }

  /* 모바일 환경에서 헤더 배경 고정 */
  @media screen and (max-width: 767px) {
    #header h1 {
      background-color: #1e1e1e !important;
    }
  }

  /* 댓글 입력창 배경 및 텍스트 */
  .tt-cmt {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
    caret-color: #ffffff !important;
  }
  
  /* 댓글창 안 텍스트 전체 흰색 */
  .tt-cmt * {
    color: #ffffff !important;
  }

  /* ===================================================================
     2. 공통 Hover 효과 및 그림자 강조
  =================================================================== */

  :root {
    --ambient-purple: rgba(178, 132, 255, 0.25);
    --ambient-glow: 0 0 12px 3px var(--ambient-purple);
  }

  /* 카드형 글 요소 */
  .post-item,
  .cover-thumbnail,
  .cover-list li,
  .article {
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    border-radius: 8px;
    padding: 0 !important;
  }
  .post-item:hover,
  .cover-thumbnail:hover,
  .cover-list li:hover,
  .article:hover {
    box-shadow: var(--ambient-glow);
    background-color: rgba(178, 132, 255, 0.05);
  }

  /* 사이드바 항목 */
  .area_sidebar .link_item,
  .area_sidebar .link_sub_item,
  .area_sidebar .tt_category,
  .sidebar .category_list > li {
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    border-radius: 10px;
  }
  .area_sidebar .link_item:hover,
  .area_sidebar .link_sub_item:hover,
  .area_sidebar .tt_category:hover,
  .sidebar .category_list > li:hover {
    box-shadow: var(--ambient-glow);
    background-color: rgba(178, 132, 255, 0.07);
  }
  .sidebar .category_list > li > a:hover {
    color: #ffffff;
  }
  .sidebar .category_list li ul li a:hover {
    background-color: rgba(178, 132, 255, 0.12);
    color: #ffffff;
  }

   /* ===================================================================
     3. 네임카드 숨기기
  =================================================================== */
  div[data-tistory-react-app="Namecard"] {
  display: none; /* 보이지 않기 */
  }
  
  /* ===================================================================
     4. 수정/삭제 팝업 메뉴 스타일
  =================================================================== */
  .my_edit .layer_edit {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 4px;
  }
  .my_edit .layer_edit li a {
    display: block;
    padding: 8px 16px;
    color: #e0e0e0 !important;
    text-decoration: none;
    transition: background-color 0.2s ease;
  }
  .my_edit .layer_edit li a:hover {
    background-color: #333333 !important;
    color: #ffffff !important;
  }

  /* ===================================================================
     5. 사이드바 카테고리 메뉴
  =================================================================== */
  .sidebar .category_list > li {
    background-color: #2b2b2b;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background-color 0.3s ease;
  }
  .sidebar .category_list > li > a {
    display: block;
    color: #f0f0f0;
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 500;
  }
  .sidebar .category_list li ul {
    display: block;
    padding: 8px 0 8px 16px;
    background-color: #1e1e1e;
    border-radius: 0 0 10px 10px;
  }
  .sidebar .category_list li ul li a {
    display: block;
    color: #cccccc;
    padding: 6px 10px;
    text-decoration: none;
    font-size: 0.95em;
    border-radius: 6px;
    transition: background-color 0.2s ease;
  }

  /* ===================================================================
     6. 다크모드 네온 표 (부드러운 곡선 + 가운데 정렬)
=================================================================== */
/* HTML 모드에서 표의 최상단에 <table class="dark-table">만 붙이면 해당 스타일이 적용된다. */

  .dark-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em 0;
    font-size: 1em;
    background-color: #1f1f1f;
    color: #e0e0e0;
    border: 1px solid #444;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.25);
    border-radius: 14px;
    overflow: hidden;
    text-align: center;
  }

  .dark-table th,
  .dark-table td {
    border: 1px solid #444;
    padding: 12px;
    text-align: center; /* 가운데 정렬 */
    vertical-align: middle;
  }

  .dark-table thead {
    background-color: #2a2a2a;
    color: #00ffe0;
    text-shadow: 0 0 4px rgba(0, 255, 255, 0.5);
  }

  .dark-table tbody tr:nth-child(even) {
    background-color: #262626;
  }

  .dark-table tbody tr:hover {
    background-color: #333;
  }

}

  /* ===================================================================
    7.첨부파일 박스 스타일(단색 배경 + 부드러운 테두리 + 테두리 효과
=================================================================== */

#article-view figure.fileblock {
  background-color: #2a2a2a;                            /* 살짝 밝은 짙은 회색 배경 */
  border-radius: 12px;                                  /* 부드러운 둥근 테두리 */
  position: relative;
  overflow: hidden;
  z-index: 0;
  box-shadow: 0 0 8px 1px rgba(120, 220, 255, 0.15);     /* 기본 푸른빛 테두리 주변 퍼짐 */
  transition: box-shadow 0.3s ease;
}

/* 내부 텍스트와 아이콘이 위로 보이게 설정 */
#article-view figure.fileblock * {
  position: relative;
  z-index: 2;
}

/* 호버 시 노란빛 테두리 앰비언트 효과로 전환 */
#article-view figure.fileblock:hover {
  box-shadow: 0 0 12px 3px rgba(255, 235, 160, 0.35); /* 노란빛 주변 퍼짐 */
}

/* ===================================================== */
/* ◆ 끝: 만년교생의 다크모드 커스터마이징 ◆ */
/* ===================================================== */