说明

默认的git bash配色实在太难看,所以在网上找了一下配色方案,结果都不满意。很多IDE一直用的都是atom-one-dark配色主题,所以Git也使用这个,特此记录。

步骤

配色使用的到颜色如下:(可根据自己喜好修改)

color_reference

先放一张VScode配色图:
VScode配色

可能有些人注意到了,本站默认的代码配色方案也是atom-one-dark,如下:

<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
if (!empty($this->options->cdn) && $this->options->cdn) {
  define('__TYPECHO_THEME_URL__', Typecho_Common::url(__TYPECHO_THEME_DIR__ . '/' . basename(dirname(__FILE__)), $this->options->cdn));
}

$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$site = $http_type . $_SERVER['HTTP_HOST'];
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
  <title><?php $this->archiveTitle(array(
      'category' => _t('%s'),
      'search' => _t('%s'),
      'tag' => _t('%s'),
      'author' => _t('%s')
    ), '', ' - '); ?><?php $this->options->title(); ?><?php if ($this->is('index') && $this->options->Subtitle != null) {
      echo ' - ' . $this->options->Subtitle;
    } ?></title>
  <link rel="dns-prefetch" href="<?php $this->options->siteUrl(); ?>">
  <?php if (!empty($this->options->qiniu)): ?>
    <link rel="dns-prefetch" href="<?php echo $this->options->qiniu; ?>">
  <?php endif; ?>
  <?php if ($this->options->logoUrl): ?>
    <link rel="shortcut icon" href="<?= $this->options->logoUrl ?>" type="image/png"/>
  <?php endif; ?>
  <link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css">
  <link type="text/css" rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.12.0/css/all.min.css">
  <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/styles.css'); ?>">
  <?php if ($this->is('post')): ?>
    <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/style.css'); ?>">
  <?php endif; ?>
  <?php if($this->options->Logo != null): ?>
    <link rel="shortcut icon" href="<?= $this->options->Logo; ?>" type="image/png" />
  <?php endif ?>
  <?php $this->header(); ?>
  <?php if (!Utils::isEnabled('enableComments', 'JConfig') && $this->is('post')): ?>
    <script src='//unpkg.com/valine/dist/Valine.min.js'></script>
  <?php endif ?>

好了,言归正传,下面我们开始配置git bash

  1. 打开git bash,切换至用户目录,即cd ~
  2. 修改配置文件,即vi .minttyrc
  3. 配置文件内容修改如下:(若没有此文件,新建即可)
Font=Consolas
FontHeight=10

ForegroundColour=131,148,150
BackgroundColour=40,44,52
CursorColour=82,139,255

Black=40,44,52
BoldBlack=90,44,52
Red=224,108,117
BoldRed=255,108,117
Green=152,195,121
BoldGreen=152,245,121
Yellow=229,192,123
BoldYellow=229,192,173
Blue=97,175,239
BoldBlue=97,175,255
Magenta=198,120,221
BoldMagenta=248,120,221
Cyan=86,182,194
BoldCyan=86,232,194
White=171,178,191
BoldWhite=231,178,191
BoldAsFont=-1
FontSmoothing=full
FontWeight=700
Locale=C
Charset=UTF-8
Columns=80
Rows=28

重启git bash,效果如下:

git bash主界面

git bash编辑文件界面

补充

使用vi命令之后,是无法编辑文件的,按下insert键,底部状态显示insert则此时可以输入内容,保存时,请先按Esc退出insert状态,然后输入wq保存并退出

Last modification:March 16th, 2020 at 01:16 pm
^_^您的每一分钱,都是对我最大的鼓励!