1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-31 07:26:09 +00:00

Markdown styles

This commit is contained in:
Yan Maniez 2018-06-20 10:48:15 +02:00
parent c721858bc6
commit c802c030b0
2 changed files with 49 additions and 3 deletions

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace AideDeJeu.Tools
{
public class MonsterMarkdownTheme : Xam.Forms.Markdown.MarkdownTheme
{
public MonsterMarkdownTheme()
{
//this.Paragraph.FontFamily = "LinLibertine_aS.ttf#Linux Libertine Capitals";
this.BackgroundColor = DefaultBackgroundColor;
this.Paragraph.ForegroundColor = DefaultTextColor;
this.Heading1.ForegroundColor = DefaultTextColor;
this.Heading1.BorderColor = DefaultSeparatorColor;
this.Heading2.ForegroundColor = DefaultTextColor;
this.Heading2.BorderColor = DefaultSeparatorColor;
this.Heading3.ForegroundColor = DefaultTextColor;
this.Heading4.ForegroundColor = DefaultTextColor;
this.Heading5.ForegroundColor = DefaultTextColor;
this.Heading6.ForegroundColor = DefaultTextColor;
this.Link.ForegroundColor = DefaultAccentColor;
this.Code.ForegroundColor = DefaultTextColor;
this.Code.BackgroundColor = DefaultCodeBackground;
this.Quote.ForegroundColor = DefaultQuoteTextColor;
this.Quote.BorderColor = DefaultQuoteBorderColor;
this.Separator.BorderColor = DefaultSeparatorColor;
}
public static readonly Color DefaultBackgroundColor = Color.FromHex("#F7F2E5");
public static readonly Color DefaultAccentColor = Color.FromHex("#0366d6");
public static readonly Color DefaultTextColor = Color.FromHex("#24292e");
public static readonly Color DefaultCodeBackground = Color.FromHex("#f6f8fa");
public static readonly Color DefaultSeparatorColor = Color.FromHex("#eaecef");
public static readonly Color DefaultQuoteTextColor = Color.FromHex("#6a737d");
public static readonly Color DefaultQuoteBorderColor = Color.FromHex("#dfe2e5");
}
}

View file

@ -8,6 +8,7 @@
Title="{Binding Title}">
<ContentPage.Resources>
<ResourceDictionary>
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
<tools:HtmlNodeToFormattedStringConverter x:Key="HtmlNodeToFormattedStringConverter" />
<tools:HtmlNodesToFormattedStringConverter x:Key="HtmlNodesToFormattedStringConverter" />
@ -80,15 +81,15 @@
<Label Text="Capacités" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView Padding="0" CascadeInputTransparent="True" Margin="0" BackgroundColor="Aqua" InputTransparent="True" HorizontalOptions="FillAndExpand" Markdown="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<mdview:MarkdownView Theme="{StaticResource MonsterMarkdownTheme}" Markdown="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<!--<ListView ItemsSource="{Binding Item.SpecialFeaturesNodes}">
<ListView.ItemTemplate>